@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Cinzel:wght@400;700&family=MedievalSharp&display=swap');

:root {
    /* Without this the browser assumes the page is light and Chrome's Auto Dark Mode
       (and dark-mode extensions) recolour the text - on an already dark palette that
       produces dark text on a dark background. */
    color-scheme: dark;
}

body.activity-page {
    /* User Experience is the one light page. */
    color-scheme: light;
}

:root {
    /* Modern Theme Defaults */
    --bg-image: url('hero_background.png');
    --bg-overlay: rgba(15, 23, 42, 0.9);
    --font-main: 'Outfit', sans-serif;
    --font-header: 'Outfit', sans-serif;
    --text-color: #f8fafc;
    --input-bg: rgba(30, 41, 59, 0.7);
    --input-border: 1px solid rgba(255, 255, 255, 0.1);
    --btn-primary-bg: linear-gradient(135deg, #8b5cf6, #3b82f6);
    --btn-text: white;
    --card-bg: rgba(255, 255, 255, 0.05);
    /* Slightly more opaque for dashboard */
    --card-border: 1px solid rgba(255, 255, 255, 0.1);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --card-radius: 12px;

    /* Dashboard Specific */
    --sidebar-bg: rgba(15, 23, 42, 0.95);
    --sidebar-width: 260px;
    --nav-item-hover: rgba(255, 255, 255, 0.1);
    --accent-color: #4ade80;
}

body.medieval {
    /* Medieval Theme Overrides */
    --bg-image: url('tavern_background.png');
    --bg-overlay: rgba(0, 0, 0, 0.7);
    /* Fonts */
    --font-main: 'Cinzel', serif;
    --font-header: 'MedievalSharp', cursive;
    /* Colors */
    --text-color: #3e2723;
    /* Inputs */
    --input-bg: #fff8dc;
    --input-border: 2px solid #5d4037;
    /* Buttons */
    --btn-primary-bg: #5d4037;
    --btn-text: #ffecb3;
    /* Cards */
    --card-bg: rgba(255, 235, 205, 0.95);
    --card-border: 2px solid #8d6e63;
    --card-shadow: 4px 4px 0 #3e2723;
    --card-radius: 4px;

    /* Dashboard Specific */
    --sidebar-bg: #d2b48c;
    /* Tan parchment */
    --nav-item-hover: rgba(93, 64, 55, 0.1);
    --accent-color: #d84315;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s ease;
    /* Faster transition for UI elements */
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* --- Login Page Specific --- */
.login-card {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--card-shadow);
    text-align: center;
    backdrop-filter: blur(10px);
    margin: auto;
    /* Centered in flex body */
    position: relative;
    z-index: 10;
}

/* Headers */
h1 {
    font-family: var(--font-header);
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

p.subtitle {
    margin-bottom: 2rem;
    opacity: 0.8;
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--input-bg);
    border: var(--input-border);
    border-radius: 8px;
    color: inherit;
    font-family: inherit;
    font-size: 1rem;
}

input:focus {
    outline: none;
    border-color: #8b5cf6;
}

body.medieval input:focus {
    border-color: #d84315;
    background: #fff;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 0.9rem;
    background: var(--btn-primary-bg);
    color: var(--btn-text);
    border: none;
    border-radius: 50px;
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

body.medieval .btn-primary {
    border-radius: 4px;
    border: 2px solid #3e2723;
    text-shadow: 1px 1px 0 #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Google Auth */
.divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    opacity: 0.6;
    font-size: 0.72rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: currentColor;
}

.divider span {
    padding: 0 10px;
}

.btn-google {
    width: 100%;
    padding: 0.8rem;
    background: white;
    color: #333;
    border-radius: 50px;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: transform 0.2s ease;
}

body.medieval .btn-google {
    background: #fff8dc;
    border: 2px solid #5d4037;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
}

.btn-google:hover {
    background: #f1f1f1;
}

.btn-google img {
    width: 20px;
    height: 20px;
}

/* Theme Switcher */
.theme-switch-wrapper {
    position: fixed;
    bottom: 20px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    z-index: 100;
}

.theme-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
}

.theme-label.active {
    color: #4ade80;
}

body.medieval .theme-switch-wrapper {
    background: rgba(62, 39, 35, 0.9);
    border: 2px solid #8d6e63;
    border-radius: 10px;
}

body.medieval .theme-label.active {
    color: #ffecb3;
}


/* --- Dashboard Layout --- */
.dashboard-container {
    display: flex;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    backdrop-filter: blur(10px);
}

body.medieval .sidebar {
    border-right: 4px solid #5d4037;
    background-image: url('https://www.transparenttextures.com/patterns/aged-paper.png');
}

.content-area {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

/* Sidebar Nav */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}
.sidebar-header h2 {
    font-family: var(--font-header);
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 0;
}
.btn-face {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(139,92,246,0.35), rgba(59,130,246,0.35));
    border: 1px solid rgba(139,92,246,0.5);
    border-radius: 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}
.btn-face:hover {
    background: linear-gradient(135deg, rgba(139,92,246,0.6), rgba(59,130,246,0.6));
    border-color: rgba(139,92,246,0.9);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(139,92,246,0.4);
}
body.medieval .btn-face {
    background: linear-gradient(135deg, rgba(93,64,55,0.5), rgba(141,110,99,0.5));
    border: 1px solid #5d4037;
    color: #3e2723;
    font-family: var(--font-header);
}
body.medieval .btn-face:hover {
    background: rgba(93,64,55,0.8);
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 8px;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: var(--nav-item-hover);
    transform: translateX(5px);
}

.nav-item .icon {
    margin-right: 12px;
    font-size: 1.2rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.medieval .sidebar-footer {
    border-top: 2px solid #5d4037;
}

.btn-logout {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    cursor: pointer;
    border-radius: 6px;
    font-family: var(--font-main);
}

body.medieval .btn-logout {
    border: 1px solid #5d4037;
    color: #3e2723;
}



.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.user-info {
    font-size: 0.9rem;
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--btn-primary-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--btn-text);
}

/* --- Views --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.view-section {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
}

.visibility-time-note {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 14px 0;
    padding: 8px 10px;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--text-color);
    font-size: 0.84rem;
    line-height: 1.35;
}

.visibility-time-note strong {
    color: var(--accent-color);
}

/* Charts */
.simple-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    height: 300px;
    padding-top: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

body.medieval .simple-bar-chart {
    border-bottom: 2px solid #5d4037;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 40px;
    background: var(--btn-primary-bg);
    border-radius: 5px 5px 0 0;
    transition: height 1s ease;
    opacity: 0.8;
}

.bar:hover {
    opacity: 1;
}

/* Stats Grid - Vertically Stacked by Default */
.stats-grid {
    display: block;
    width: 100%;
}

.stat-card {
    background: var(--card-bg);
    border: var(--card-border);
    padding: 20px;
    border-radius: var(--card-radius);
    text-align: center;
}

.stat-card .number {
    font-family: var(--font-header);
    font-size: 2.5rem;
    margin: 10px 0;
}

.trend.up {
    color: #4ade80;
}

.trend.down {
    color: #f87171;
}

body.medieval .trend.up {
    color: #2e7d32;
}

body.medieval .trend.down {
    color: #c62828;
}

/* Spreadsheet */
.spreadsheet-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border: var(--card-border);
}

.spreadsheet-table th,
.spreadsheet-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.medieval .spreadsheet-table th,
body.medieval .spreadsheet-table td {
    border-bottom: 1px solid #8d6e63;
    border-right: 1px solid #8d6e63;
}

.spreadsheet-table th {
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
}

.status.pending {
    background: #facc15;
    color: #713f12;
}

.status.booked {
    background: #4ade80;
    color: #14532d;
}

.status.cancelled {
    background: #f87171;
    color: #7f1d1d;
}

.status-post-positive {
    background: #3b82f6 !important;
    color: #fff !important;
}

/* Hall of Fame */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.achievement {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    padding: 20px;
    text-align: center;
    opacity: 1;
}

.achievement.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement .trophy {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Nails specific to medieval stats */
body.medieval .nails {
    display: block;
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background:
        radial-gradient(circle at 15px 15px, #212121 4px, transparent 5px),
        radial-gradient(circle at calc(100% - 15px) 15px, #212121 4px, transparent 5px),
        radial-gradient(circle at 15px calc(100% - 15px), #212121 4px, transparent 5px),
        radial-gradient(circle at calc(100% - 15px) calc(100% - 15px), #212121 4px, transparent 5px);
}

/* --- Admin & Modals --- */
.admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: flex !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-overlay);
    margin: 5% auto;
    padding: 0;
    border: var(--card-border);
    border-radius: var(--card-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}



.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.7;
}

.close-modal:hover {
    opacity: 1;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Body Medieval Overrides */
body.medieval .modal-content {
    background: #d2b48c;
    border: 4px solid #5d4037;
    color: #3e2723;
}

body.medieval .modal-header {
    border-bottom: 2px solid #5d4037;
}

body.medieval .btn-secondary {
    background: #5d4037;
    border: 2px solid #3e2723;
    color: #ffecb3;
    font-family: var(--font-header);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

body.medieval .btn-secondary.active {
    background: #8d6e63;
    border-color: #ffecb3;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Forms in Modal */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}



.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
    margin: 0;
}

/* User Management Layout Fixes */
.admin-users-section {
    display: flex;
    flex-direction: column;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.add-user-form {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.add-user-form input {
    margin-bottom: 8px;
}

body.medieval .admin-users-section {
    border-top: 2px solid #5d4037;
}

body.medieval .add-user-form {
    background: rgba(93, 64, 55, 0.1);
    border: 2px solid #5d4037;
}

/* User List */
/* User List */
#user-list-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.user-list-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    gap: 10px;
}

.user-list-item.hidden-user {
    opacity: 0.5;
    background: rgba(255, 0, 0, 0.05);
}

.user-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    color: var(--text-color);
    opacity: 0.7;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Database Tabs */
.db-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.db-tab {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 8px 16px;
    cursor: pointer;
    font-family: var(--font-header);
    font-size: 1rem;
    opacity: 0.6;
    border-radius: 20px;
}

.db-tab.active {
    opacity: 1;
    background: var(--btn-primary-bg);
    color: var(--btn-text);
}

body.medieval .db-tab.active {
    background: #5d4037;
    color: #ffecb3;
    border: 1px solid #3e2723;
}

/* --- Database View Styles --- */
.agent-tabs-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.agent-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.agent-tab.active {
    background: var(--accent-color);
    color: #000;
    font-weight: 600;
}

.agent-tab:hover {
    background: var(--accent-color);
    color: #000;
}

.db-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.right-controls {
    display: flex;
    gap: 10px;
}

.btn-nav,
.date-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-color);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-nav {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}

.btn-nav:active {
    transform: scale(0.9);
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Modal specific secondary button to match primary */
.modal .btn-secondary {
    border-radius: 50px;
    padding: 0.9rem 1.5rem;
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: var(--text-color);
    width: auto;
    /* Allow side-by-side flex behavior */
    min-width: 140px;
    cursor: pointer;
}

.modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Stats Dashboard Improvements */
/* Medieval Override for Modal Secondary */
body.medieval .modal .btn-secondary {
    border-radius: 4px;
    border: 2px solid #5d4037;
    background: transparent;
    color: #3e2723;
    font-family: 'Cinzel', serif;
}

body.medieval .modal .btn-secondary:hover {
    background: rgba(93, 64, 55, 0.1);
}

body.medieval .agent-tab.active {
    background: #d84315;
    color: #fff;
    border: 1px solid #3e2723;
}

.db-table-wrapper {
    overflow-x: auto;
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: 8px;
    max-height: 600px;
}

.db-table {
    width: 100%;
    table-layout: auto;
    font-size: 0.72rem;
}

.db-table th,
.db-table td {
    padding: 6px 4px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    white-space: normal;
    word-break: break-all;
    min-width: 40px;
}

.db-table th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #1e293b;
    white-space: nowrap;
}

body.medieval .db-table th {
    background: #5d4037;
}

.db-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.db-table td:focus {
    outline: 2px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

.delete-row {
    color: #f87171;
    cursor: pointer;
}

/* --- VISUAL FIXES --- */

/* Modern Theme Table Borders */
.db-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Medieval Theme Fixes */
body.medieval .agent-tab {
    background: #d2b48c;
    /* Parchment background */
    color: #3e2723;
    /* Dark brown text */
    border: 1px solid #5d4037;
    font-family: 'Cinzel', serif;
    font-weight: 600;
}

body.medieval .agent-tab:hover {
    background: #5d4037;
    color: #ffecb3;
}

body.medieval .agent-tab.active {
    background: #5d4037;
    color: #ffecb3;
    border: 1px solid #3e2723;
    box-shadow: 0 0 5px #000;
}

body.medieval .btn-secondary {
    background: #fff8dc;
    color: #3e2723;
    border: 2px solid #5d4037;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    text-shadow: none;
}

body.medieval .btn-secondary:hover {
    background: #d2b48c;
}

body.medieval .db-table td {
    border-bottom: 1px solid #8d6e63;
    border-right: 1px solid #8d6e63;
    color: #3e2723;
}

body.medieval .db-table th {
    background: #5d4037;
    color: #ffecb3;
    border-bottom: 2px solid #3e2723;
}

body.medieval .db-table-wrapper {
    background: rgba(255, 235, 205, 0.95);
    border: 4px solid #5d4037;
}

/* --- My Results (Day Sheet) Redesign --- */
.my-results-container {
    display: flex;
    flex-direction: column;
    height: auto;
    gap: 15px;
}

.results-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    border: var(--card-border);
    flex-shrink: 0;
}

.results-content {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    display: block;
    padding-bottom: 0px;
    /* Standardized spacing */
    min-height: 400px;
}

/* Day Sheet Component */
.day-sheet {
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: auto;
    margin-bottom: 30px;
    /* Standardized spacing */
    flex-shrink: 0;
}

.day-header {
    background: #00838f;
    /* Teal-ish from screenshot */
    color: white;
    padding: 10px 20px;
    font-size: 1.5rem;
    font-weight: bold;
    font-family: var(--font-header);
}

body.medieval .day-header {
    background: #5d4037;
    color: #ffecb3;
}

.day-table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    /* Force hide vertical scrollbar */
    height: max-content;
    /* Ensure it grows to fit content */
    min-height: 100px;
    padding-bottom: 0px;
}

/* Transposed Table Styles */
.transposed-table {
    border-collapse: collapse;
    width: max-content;
    height: 100%;
    table-layout: auto;
}

.transposed-table th,
.transposed-table td {
    padding: 0 4px;
    border: 1px solid #444;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    font-size: 0.68rem;
    height: 1.15rem;
    max-height: 1.15rem;
    box-sizing: border-box;
    line-height: 1.1rem;
    width: auto;
    min-width: 35px;
    max-width: 180px;
}

.transposed-table th:first-child,
.transposed-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: #1e1e1e;
    font-weight: bold;
    border-right: 2px solid #555;
    color: #e0e0e0;
    width: 125px;
    min-width: 125px;
    text-align: right;
    padding-right: 8px;
    font-size: 0.65rem;
}

body.medieval .transposed-table th:first-child,
body.medieval .transposed-table td:first-child {
    background: #d7ccc8;
    color: #3e2723;
    border-right: 2px solid #5d4037;
}

.transposed-table td:focus-within {
    outline: 2px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.5);
}

/* Alternating Row Colors (which are actually Columns in this visual, but rows in DOM) */
.transposed-table tr:nth-child(even) td:not(:first-child) {
    background: rgba(255, 255, 255, 0.02);
}

/* Status Colors */
.status-cell {
    font-weight: bold;
    cursor: pointer;
}

.status-positive {
    background-color: #dcfce7 !important;
    color: #14532d !important;
}

.status-neutral {
    background-color: #fef9c3 !important;
    color: #713f12 !important;
}

.status-negative {
    background-color: #fee2e2 !important;
    color: #7f1d1d !important;
}

.status-posts {
    background-color: #e0f2fe !important;
    color: #0c4a6e !important;
}

.status-select {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-size: inherit;
    color: inherit;
    cursor: pointer;
    text-align-last: center;
    padding: 0;
}

.status-select optgroup {
    background: #fff;
    color: #333;
    font-size: 0.75rem;
}

.status-select option {
    background: #fff;
    color: #333;
}

/* Searchable Status Dropdown */
.status-search-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.status-search-input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-size: inherit;
    color: inherit;
    text-align: center;
    padding: 0;
    cursor: text;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-search-input:focus {
    outline: none;
}

.status-dropdown-list {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    /* [FIX] Dynamic Overflow Logic: Visible for Grouped (sub-menus), Auto for Search */
    overflow: visible;
    max-height: none;
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #cccccc !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 9999999 !important;
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    text-align: left;
    border-radius: 8px;
}

.status-dropdown-list.mode-search {
    max-height: 450px;
    overflow-y: auto;
}

.status-category-header {
    background: #eeeeee;
    padding: 10px 15px;
    font-weight: 500;
    /* [FIX] Further soften bold */
    font-size: 0.72rem;
    color: #555555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
    pointer-events: auto;
}

.status-option {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #444 !important;
    text-transform: none !important;
    /* [FIX] Normal casing */
    font-weight: 400 !important;
    /* [FIX] Normal weight */
    transition: background 0.1s;
    border-bottom: 1px solid #f9f9f9;
}

.status-option:last-child {
    border-bottom: none;
}

.status-option:hover {
    background: #e0f2fe;
}

.status-option.selected {
    background: #4ade80;
    color: #fff;
}

/* Header Row (Call numbers) */
.transposed-table tr:first-child td {
    background: #e2e8f0;
    font-weight: bold;
}

body.medieval .transposed-table tr:first-child td {
    background: #d2b48c;
}

/* New Post Column (The "Spare" one) */
.new-post-column {
    background: rgba(0, 0, 0, 0.05);
    cursor: text;
    transition: background 0.2s;
}

.new-post-column:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Return List Styling */
.highlight-error {
    outline: 4px solid #ff0000 !important;
    outline-offset: -4px;
    background-color: rgba(255, 0, 0, 0.4) !important;
    box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.6), 0 0 15px rgba(255, 0, 0, 0.8) !important;
    animation: pulse-red 1s infinite alternate;
    z-index: 100;
}

@keyframes pulse-red {
    from {
        outline-color: #ff0000;
        box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.4), 0 0 10px rgba(255, 0, 0, 0.6);
    }

    to {
        outline-color: #ff5555;
        box-shadow: inset 0 0 25px rgba(255, 0, 0, 0.8), 0 0 30px rgba(255, 0, 0, 1);
    }
}

.sub-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0.6;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 15px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.sub-nav-btn.active {
    opacity: 1;
    color: #4ade80 !important;
    border-bottom: 2px solid #4ade80;
}

.sub-nav-btn:hover {
    opacity: 1;
}

body.medieval .sub-nav-btn.active {
    color: #d84315 !important;
    border-bottom: 2px solid #d84315;
}

/* --- Daily Plans & Stats Styles --- */
.stats-container {
    width: 100%;
}

.plan-input,
.stat-manual-input {
    transition: background 0.2s ease, border-color 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.plan-input:hover,
.stat-manual-input:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.plan-input:focus,
.stat-manual-input:focus {
    background: rgba(255, 255, 255, 0.15) !important;
}

.status-item-row {
    transition: background 0.2s ease, transform 0.1s ease;
}

.status-item-row:hover {
    background: rgba(255, 255, 255, 0.85) !important;
    transform: scale(1.01);
}

.plans-stats-split h3 {
    font-family: var(--font-header);
    letter-spacing: 1px;
    opacity: 0.9;
}

/* Active Work Table Theme overrides */
.table-theme-light {
    background: #ffffff;
    padding: 2px;
    border-radius: 8px;
}

.table-theme-light .transposed-table {
    background: #ffffff;
    color: #101827;
}

.table-theme-light .transposed-table td {
    background: #ffffff;
    color: #101827;
    border: 1px solid #e5e7eb;
}

.table-theme-light .transposed-table .field-label {
    background: #e0e0e0 !important;
    color: #000 !important;
    border-right: 2px solid #999 !important;
}

.table-theme-light .grid-cell {
    background: #ffffff;
    color: #101827;
}

.table-theme-light .grid-cell:focus {
    background: #fff9c4;
    outline: 2px solid #2196f3;
}

.table-theme-light .display-cell {
    background: #f5f5f5;
    color: #101827;
}

.table-theme-light .status-select {
    background: #ffffff;
    color: #101827;
    border: 1px solid #ccc;
}

.table-theme-light .new-post-column {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
}

/* Ensure status and selection win in light mode */
.table-theme-light .grid-cell.selected-cell,
.table-theme-light .transposed-table td.selected-cell {
    background-color: rgba(33, 150, 243, 0.4) !important;
    border: 2px solid #2196f3 !important;
}

.table-theme-light .status-positive {
    background-color: #dcfce7 !important;
    color: #14532d !important;
}

.table-theme-light .status-neutral {
    background-color: #fef9c3 !important;
    color: #713f12 !important;
}

.table-theme-light .status-negative {
    background-color: #fee2e2 !important;
    color: #7f1d1d !important;
}

.table-theme-light .status-posts {
    background-color: #e0f2fe !important;
    color: #0c4a6e !important;
}

/* Ensure selection highlight wins over everything in light mode */
.table-theme-light .grid-cell.selected-cell,
.table-theme-light .transposed-table td.selected-cell {
    background-color: rgba(33, 150, 243, 0.5) !important;
    border: 2px solid #2196f3 !important;
    z-index: 20;
}

/* --- Spreadsheet Selection & Copy --- */
.selected-cell {
    background-color: rgba(33, 150, 243, 0.4) !important;
    border: 2px solid #2196f3 !important;
    z-index: 5;
    position: relative;
}

/* --- Database Return List Compact Mode --- */
.db-table-wrapper.small-text .db-table th,
.db-table-wrapper.small-text .db-table td {
    font-size: 0.72rem;
    /* Smaller font */
    padding: 6px 10px;
    /* Reduced padding */
}

.db-table-wrapper.small-text .db-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Database Summary Card */
.db-summary-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.db-summary-grid {
    display: flex;
    gap: 30px;
}

.db-summary-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.db-summary-header {
    font-size: 0.8rem;
    font-weight: bold;
    color: #4caf50;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(76, 175, 80, 0.3);
    padding-bottom: 5px;
}

.group-plan .db-summary-header {
    color: #2196f3;
    border-bottom-color: rgba(33, 150, 243, 0.3);
}

.db-summary-values {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.pos-card-type {
    display: inline-block;
    padding: 2px 6px;
    margin: 4px 0;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    font-size: 0.75rem;
    color: #e2e8f0;
}
.pos-card-status {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* Collapse behavior during drag - Matrix/Grid tiles */
body.pos-dragging .pos-board {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
}
body.pos-dragging .pos-row {
    position: relative;
    flex: 0 0 calc(25% - 12px);
    min-height: 80px;
    height: 80px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
body.pos-dragging .pos-row-label {
    position: relative;
    z-index: 0;
    flex: none;
    width: 100%;
    padding: 8px 10px;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: normal;
    text-align: center;
    color: #fff;
    pointer-events: none;
}
body.pos-dragging .pos-cards-area {
    position: absolute;
    inset: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 0 !important;
    min-height: 0 !important;
    overflow: hidden;
    z-index: 2;
}
body.pos-dragging .pos-empty-hint {
    display: none !important;
}
body.pos-dragging .pos-card:not(.dragging) {
    display: none !important;
}
body.pos-dragging .pos-card.dragging {
    opacity: 0.08;
    pointer-events: none;
    transform: scale(0.4);
    flex-shrink: 0;
}
body.pos-dragging .pos-row.drop-active {
    background: rgba(74, 222, 128, 0.25) !important;
    border-color: #4ade80 !important;
    transform: scale(1.06);
}

.db-sm-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 6px;
}

.db-sm-item label {
    font-size: 0.65rem;
    color: #aaa;
    text-transform: uppercase;
}

.db-sm-item span {
    font-size: 0.9rem;
    font-weight: bold;
    color: #fff;
}

/* Fix Active Work View Buttons Highlight (Modern) */
body:not(.medieval) .results-controls .btn-secondary.active {
    background: #4ade80 !important;
    border-color: #4ade80 !important;
    color: white !important;
    box-shadow: 0 0 5px rgba(74, 222, 128, 0.5);
}

/* Agent Selector Dropdown for Windows Visibility */
#my-stats-agent-selector option {
    background-color: #333;
    color: #fff;
}

/* Active Work Agent Selector Dropdown for Windows Visibility */
#active-work-agent-selector option {
    background-color: #333;
    color: #fff;
}

/* Search Footer Layout */
.search-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.search-stats {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 0.95rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item strong {
    color: #4ade80;
    /* Green accent */
    margin-left: 5px;
}

.stat-separator {
    color: #64748b;
}

/* Button Styling for Search Footer */
.btn-search-new {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    /* Indigo/Purple */
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 25px;
    height: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    /* Duplicate dims logic */
}

.btn-search-new:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.3);
}

.btn-clear {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0 25px;
    height: 40px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 120px;
    /* Duplicate dims logic */
}

.btn-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

/* Stats Dashboard Improvements */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 columns for New Business */
    gap: 20px;
    margin-top: 15px;
    margin-bottom: 20px;
    padding: 0;
    background: transparent;
    border: none;
    justify-content: normal;
}

/* ... existing styles ... */

/* Blue for Current */
#last-companies,
#last-contacts {
    color: #94a3b8;
}

/* Purple for New Business */
#new-companies,
#new-contacts {
    color: #a78bfa;
}

.stats-group {
    display: flex;
    flex-direction: column;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.stats-group:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    /* Reset from previous bad css if needed, but here just standard border */
}

.stats-header {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 8px;
    font-weight: 600;
}

.stats-grid {
    display: flex;
    gap: 15px;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-box label {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 2px;
}

.stat-box strong {
    font-size: 1.1rem;
    color: #e2e8f0;
}

/* Specific Colors for Context */
#sel-companies,
#sel-contacts {
    color: #4ade80;
}

/* Green for Selection */
#sel-ratio {
    color: #facc15;
}

/* Yellow for Ratio */
#cur-companies,
#cur-contacts {
    color: #60a5fa;
}

/* Blue for Current */
#last-companies,
#last-contacts {
    color: #94a3b8;
}

/* Gray for Past */

/* Entity Detail View (Split Layout) */
/* Entity Detail View (Split Layout) */
#entity-details-container {
    display: none;
    /* Hidden by default */
    flex-direction: row;
    gap: 30px;
    height: auto;
    /* Remove fixed height */
    min-height: 0;
    /* Allow flex children to shrink/scroll */
}

@media (max-width: 900px) {
    #entity-details-container {
        flex-direction: column;
    }
}

.entity-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    /* overflow-y: auto;  REMOVED: Pane shouldn't scroll, only table should */
}

.entity-pane-header {
    font-size: 1rem;
    color: #94a3b8;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Profile Card */
.profile-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.profile-field {
    display: flex;
    flex-direction: column;
}

.profile-field label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 4px;
}

/* Touches Chart Container */
#touches-chart-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    display: none;
    flex-direction: column;
    height: 380px;
    /* Matches height of Profile Card + Touch Summary approx */
    margin-bottom: 20px;
}

.chart-header .view-toggle button {
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 0 16px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-header .view-toggle button.active {
    background: var(--accent-color);
    color: #000;
}

.chart-header .view-toggle button:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.status-option:hover {
    background: #e3f2fd !important;
    /* Classic soft blue highlight */
    color: #000 !important;
}


.profile-field .value {
    font-size: 0.95rem;
    color: #e2e8f0;
    font-weight: 500;
}

.profile-field .value .source-tag {
    font-size: 0.75rem;
    color: #a78bfa;
    /* Distinct color for source agent */
    margin-left: 6px;
    font-style: italic;
}

/* Personal Stats Grid */
.detail-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

/* Team Stats Counter (Right Pane Top) */
/* Team Stats Counter (Right Pane Top) */
.team-stats-counter {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
    align-items: center;
    gap: 20px;
}

.team-stats-total-row {
    display: flex;
    justify-content: center;
    border-bottom: none;
    padding-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding-right: 20px;
}

.team-stats-breakdown-row {
    flex: 1;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.team-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.team-stat-item label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
}

.team-stat-item strong {
    font-size: 1.2rem;
    color: #e2e8f0;
}

/* Table Row Backgrounds */
.row-positive {
    background-color: rgba(220, 252, 231, 0.1);
    /* Green tint */
}

.row-neutral {
    background-color: rgba(254, 249, 195, 0.1);
    /* Yellow tint */
}

.row-negative {
    background-color: rgba(254, 226, 226, 0.1);
    /* Red tint */
}

.row-other {
    background-color: rgba(207, 250, 254, 0.1);
    /* Cyan tint */
}


/* History Tables Wrapper */
.history-table-container {
    max-height: 600px;
    /* Approx 20-25 rows */
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.history-table th {
    text-align: left;
    color: #94a3b8;
    font-weight: 500;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: #0f172a;
    /* Match body bg for sticky header cover */
}

.history-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.time-ago-sub {
    font-size: 0.75rem;
    color: #64748b;
    margin-left: 6px;
}

/* Status Text Colors for Stats */
.status-text-positive {
    color: #4ade80 !important;
    /* Green */
}

.status-text-neutral {
    color: #facc15 !important;
    /* Yellow */
}

.status-text-negative {
    color: #f87171 !important;
    /* Red */
}

/* Ensure Team Stats labels are lighter so colored numbers pop */
.team-stat-item label {
    color: #aaa;
    font-size: 0.7rem;
    text-transform: uppercase;
    display: block;
}

.team-stat-item strong {
    font-size: 1.2rem;
    display: block;
}

/* Targeted fix for Edit User Modal Cancel Button */
#edit-user-modal .btn-secondary {
    border-radius: 50px;
    padding: calc(0.9rem - 2px) 1.5rem;
    /* Compensate for 2px border to match btn-primary height */
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: var(--text-color);
    width: auto;
    min-width: 120px;
    cursor: pointer;
    margin-top: 1rem;
    /* Match btn-primary */
    margin-bottom: 1.5rem;
    /* Match btn-primary */
}

#edit-user-modal .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Active Work Progress Bar */

.aw-progress-container {
    position: relative;
    overflow: hidden;
    /* Height and Border set inline or here */
    border-radius: 6px;
}

/* Label removed */

.aw-progress-track {
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: inherit;
    overflow: hidden;
    position: relative;
}

.aw-progress-bar {
    height: 100%;
    width: 0%;
    /* Dynamic */
    background: var(--accent-color);
    border-radius: inherit;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    position: relative;
    /* Clean bar - no text styles */
}

.aw-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 60%);
    background-size: 200% 200%;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

/* Glitter Animation Keyframes */
@keyframes glitter-shine {
    0% {
        background-position: 200% center;
        opacity: 0.5;
    }

    100% {
        background-position: -200% center;
        opacity: 0.5;
    }
}

@keyframes heavenly-pulse {
    0% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.9), 0 0 10px rgba(255, 255, 255, 0.5) inset;
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
}

/* Glitter Classes */
.aw-progress-bar.animated::after {
    animation: glitter-shine 3s linear infinite;
    opacity: 1;
}

/* Extended Glitter Tiers */

/* <= 150% - Light Blue */
.glitter-blue {
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #3b82f6) !important;
    background-size: 200% 100% !important;
}

/* <= 200% - Pink */
/* "Loading Bar" Glowing Gradient Animation */
@keyframes gradient-move {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.aw-progress-bar.animated {
    /* Larger size for smoother flow */
    background-size: 400% 400% !important;
    animation: gradient-move 3s ease infinite !important;
}

.aw-progress-bar.animated::after {
    content: none;
}

/* Extended Tiers with Gradient Definitions */

/* <= 150% - Light Blue Gradient */
.glitter-blue {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 50%, #3b82f6 100%) !important;
}

/* <= 200% - Pink Gradient */
.glitter-pink {
    background: linear-gradient(90deg, #ec4899 0%, #f472b6 50%, #ec4899 100%) !important;
}

/* <= 300% - Bronze Gradient */
.glitter-bronze {
    background: linear-gradient(90deg, #b45309 0%, #d97706 50%, #b45309 100%) !important;
}

/* <= 400% - Silver Gradient */
.glitter-silver {
    background: linear-gradient(90deg, #64748b 0%, #94a3b8 50%, #64748b 100%) !important;
}

/* <= 500% - Gold Gradient */
.glitter-gold {
    background: linear-gradient(90deg, #eab308 0%, #facc15 50%, #eab308 100%) !important;
}

/* > 500% - Heavenly White Gradient */
.glitter-white {
    background: linear-gradient(90deg, #e2e8f0 0%, #ffffff 50%, #e2e8f0 100%) !important;
    color: #333 !important;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.glitter-white.animated {
    animation: heavenly-pulse 2s infinite ease-in-out;
}

/* Active Work Progress Bar Animation */
.aw-progress-bar.animated {
    animation: progressBarPulse 4s infinite ease-in-out;
}

@keyframes progressBarPulse {
    0% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
        filter: brightness(1);
    }

    50% {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
        filter: brightness(1.3);
    }

    100% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
        filter: brightness(1);
    }
}

/* Loading/Glow effect overlay */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Enhanced Blue Shimmer / Game-UI Style */
.aw-progress-bar.animated {
    animation: progressBarPulse 3s infinite ease-in-out;
}

@keyframes progressBarPulse {
    0% {
        filter: brightness(1) drop-shadow(0 0 2px rgba(59, 130, 246, 0.3));
    }

    50% {
        filter: brightness(1.4) drop-shadow(0 0 10px rgba(59, 130, 246, 0.8));
    }

    100% {
        filter: brightness(1) drop-shadow(0 0 2px rgba(59, 130, 246, 0.3));
    }
}

/* Shiny Shimmer Overlay - Only active if the container has .active-shimmer */
.aw-progress-container.active-shimmer::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(59, 130, 246, 0.1),
            rgba(255, 255, 255, 0.3),
            rgba(59, 130, 246, 0.1),
            transparent);
    transform: translateX(-100%);
    animation: shimmer 3s infinite ease-out;
    pointer-events: none;
    z-index: 5;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(100%);
    }

    /* Full pass in 1.5s (half of 3s) */
    100% {
        transform: translateX(100%);
    }

    /* Remaining 1.5s wait */
}

.aw-stage-label {
    text-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Active Work Dots visualization */
.aw-dots-container {
    display: flex;
    gap: 6px;
    align-items: center;
}

.aw-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.aw-dot-future {
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.aw-dot-completed {
    /* Color set inline */
    box-shadow: 0 0 5px currentColor;
}

.aw-dot-active {
    /* Color and vars set inline */
    animation: aw-dot-pulse var(--aw-dot-duration) infinite ease-in-out;
}

.aw-dot-active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--aw-dot-color);
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: aw-dot-aura var(--aw-dot-duration) infinite ease-out;
}

@keyframes aw-dot-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.9;
        filter: brightness(1.3);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes aw-dot-aura {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) scale(var(--aw-dot-aura-scale));
        opacity: 0;
    }
}


/* --- New 10-Tier Progress Bar System --- */
.progress-red {
    background-color: #ff3b3b;
    box-shadow: 0 0 6px rgba(255, 59, 59, 0.4), 0 0 14px rgba(255, 59, 59, 0.2);
}

.progress-orange {
    background-color: #ff7a18;
    box-shadow: 0 0 8px rgba(255, 122, 24, 0.4), 0 0 18px rgba(255, 122, 24, 0.2);
}

.progress-amber {
    background-color: #ffb800;
    box-shadow: 0 0 10px rgba(255, 184, 0, 0.4), 0 0 22px rgba(255, 184, 0, 0.2);
}

.progress-green {
    background-color: #00d26a;
    box-shadow: 0 0 12px rgba(0, 210, 106, 0.4), 0 0 26px rgba(0, 210, 106, 0.2);
}

.progress-neon-cyan {
    background-color: #00d1ff;
    box-shadow: 0 0 14px rgba(0, 209, 255, 0.5), 0 0 30px rgba(0, 209, 255, 0.25);
}

.progress-neon-magenta {
    background-color: #ff3df2;
    box-shadow: 0 0 16px rgba(255, 61, 242, 0.5), 0 0 34px rgba(255, 61, 242, 0.25);
}

/* Metallic Gradients */
.progress-bronze {
    background: linear-gradient(to right, #c77700, #ffb020, #fff1c7);
    box-shadow: 0 0 18px rgba(199, 119, 0, 0.5), 0 0 38px rgba(199, 119, 0, 0.25);
}

.progress-silver {
    background: linear-gradient(to right, #9aa8c7, #d6ddff, #ffffff);
    box-shadow: 0 0 20px rgba(154, 168, 199, 0.5), 0 0 42px rgba(154, 168, 199, 0.25);
}

.progress-gold {
    background: linear-gradient(to right, #c89b00, #ffe66d, #fff7c2);
    box-shadow: 0 0 22px rgba(200, 155, 0, 0.5), 0 0 46px rgba(200, 155, 0, 0.25);
}

.progress-white {
    background: linear-gradient(to right, #e9f3ff, #ffffff, #cfe6ff);
    box-shadow: 0 0 26px rgba(233, 243, 255, 0.6), 0 0 56px rgba(233, 243, 255, 0.3);
}

.aw-next-stage-uncover {
    font-size: 0.85rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.2);
    min-width: 65px;
    height: 18px;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    white-space: nowrap;
    margin-left: 5px;
}

.aw-next-stage-uncover-text {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    color: #fff;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

@keyframes blink-red {
    0% {
        background-color: transparent;
    }

    50% {
        background-color: rgba(255, 0, 0, 0.5);
    }

    100% {
        background-color: transparent;
    }
}

.blink-error {
    animation: blink-red 0.5s ease-in-out 3;
    border: 2px solid #ff3b3b !important;
}

/* Phone Type Modal (Premium Design) */
.phone-type-content {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: 15% auto !important;
}

#phone-type-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: #fff;
    letter-spacing: -0.02em;
}

#phone-type-message {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-bottom: 40px;
}

.phone-type-options {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.btn-phone-type {
    flex: 1;
    height: 70px;
    border: none;
    border-radius: 40px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: white;
}

.btn-phone-type.office {
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

.btn-phone-type.personal {
    background: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
    color: #fff;
}

.btn-phone-type:hover {
    transform: translateY(-4px);
    filter: brightness(1.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.btn-phone-type:active {
    transform: translateY(0);
}

.btn-cancel-phone {
    background: #334155;
    color: #f8fafc;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 150px;
}

.btn-cancel-phone:hover {
    background: #475569;
}

/* Medieval Override */
body.medieval .phone-type-content {
    background: #d2b48c;
    border: 4px solid #5d4037;
    border-radius: 12px;
}

body.medieval .btn-phone-type {
    border-radius: 8px;
    border: 2px solid #5d4037;
    font-family: 'Cinzel', serif;
}

body.medieval .btn-phone-type.office {
    background: #5c6bc0;
}

body.medieval .btn-phone-type.personal {
    background: #66bb6a;
}

/* Status Mode Switcher (Sleek Toggle) */
.status-mode-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 5px;
}

.status-mode-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 18px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4ade80;
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* Grouped Status Menu Styles */
.status-category-header.is-grouped {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #eeeeee !important;
    font-weight: 500;
    /* [FIX] Further soften bold */
    text-transform: uppercase;
    cursor: pointer !important;
    border-left: 3px solid transparent;
    pointer-events: auto !important;
}

.status-category-header.is-grouped:hover {
    background: #e3f2fd !important;
    /* Highlight on hover */
    color: #1a73e8 !important;
}

.status-category-header.is-grouped::after {
    content: '▶';
    font-size: 0.8em;
    opacity: 0.8;
    color: #4ade80;
    /* Glow hint */
    margin-right: 5px;
}

.status-category-header.cat-positive {
    border-left-color: #4ade80;
}

.status-category-header.cat-neutral {
    border-left-color: #94a3b8;
}

.status-category-header.cat-negative {
    border-left-color: #f87171;
}

.status-category-header.cat-posts {
    border-left-color: #60a5fa;
}

.status-category-header.cat-post-positive {
    border-left-color: #c084fc;
}

.status-submenu {
    position: absolute;
    left: var(--status-submenu-left, 100%);
    right: var(--status-submenu-right, auto);
    top: 50% !important;
    /* [FIX] Center vertically relative to group */
    transform: translateY(-50%) !important;
    width: 250px;
    background: #ffffff !important;
    /* Classic light */
    color: #333333 !important;
    border: 1px solid #cccccc !important;
    border-radius: 8px;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10000001;
    max-height: 480px;
    /* [FIX] Allow more items before scrolling */
    overflow-y: auto;
    padding: 0;
}

.status-category-header.is-grouped:hover .status-submenu {
    display: block !important;
    animation: fadeInStatusCentered 0.2s ease;
}

@keyframes fadeInStatusCentered {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.status-option.in-submenu {
    font-size: 0.75rem;
    padding: 10px 15px;
    color: #444 !important;
    text-transform: none !important;
    /* [FIX] Normal casing */
    font-weight: 400 !important;
    /* [FIX] Normal weight */
    border-bottom: 1px solid #f9f9f9;
}

.status-option.in-submenu:last-child {
    border-bottom: none;
}

.status-option.in-submenu:hover {
    background: #e3f2fd !important;
    color: #000 !important;
}

/* --- Contact Insight Component --- */

.contact-insight-container {
    height: 180px;
    /* Doubled height */
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 30px;
    /* Standardized spacing */
    display: flex;
    align-items: center;
    padding: 0 20px;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ci-section {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Left: Input & Info */
.ci-left {
    flex: 0 0 350px;
    width: 350px;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 20px;
    padding-right: 20px;
}

.ci-input-group {
    display: flex;
    flex-direction: column;
    margin-right: 25px;
    align-items: center;
    /* Center Column label over stepper */
}

.ci-input-group label {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 2px;
    text-transform: uppercase;
}

#ci-col-index {
    background: transparent;
    border: none;
    color: #fff;
    width: 100%;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 800;
    padding: 0;
    margin: 0;
    outline: none;
    appearance: none;
    -moz-appearance: textfield;
}

#ci-col-index::-webkit-outer-spin-button,
#ci-col-index::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ci-col-stepper {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    width: 65px;
    padding: 2px 0;
}

.ci-step-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 2px 10px;
    width: 100%;
    transition: all 0.2s;
    user-select: none;
}

.ci-step-btn:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

.ci-step-btn:active {
    transform: scale(0.9);
}

.ci-col-display {
    padding: 4px 0;
    width: 100%;
    display: flex;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ci-info-display {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ci-placeholder {
    color: #64748b;
    font-size: 0.85rem;
    font-style: italic;
}

.ci-loading-text {
    color: var(--accent-color);
    font-size: 0.85rem;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

.ci-linked-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ci-company {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.ci-detail {
    font-size: 0.8rem;
    color: #94a3b8;
    white-space: normal;
    /* Allow wrapping for multiple contacts */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* Show up to 2 lines */
    -webkit-box-orient: vertical;
}

.ci-detail .source-tag {
    color: #a78bfa;
    /* Violet color for agent name */
    font-style: italic;
    font-size: 0.75rem;
    margin-left: 4px;
}

/* Center: Touchpoint */
.ci-center {
    flex: 0 0 80px;
    width: 80px;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    margin-right: 20px;
    padding-right: 20px;
}

.ci-touch-count-zero {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4ade80;
    /* Green */
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
    letter-spacing: 1px;
}

.ci-touch-count-zero--brand-new,
.ci-touch-count-zero--customer,
.ci-touch-count-zero--past-customer {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    background: transparent;
}

.ci-touch-count-zero--brand-new {
    color: #a78bfa;
    border-color: #a78bfa;
    text-shadow: 0 0 10px rgba(167, 139, 250, 0.26);
}

.ci-touch-count-zero--customer {
    color: #ef4444;
    border-color: #ef4444;
    font-size: 1rem;
    line-height: 1.15;
    padding: 0;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.22);
}

.ci-touch-count-zero--past-customer {
    color: #a78bfa;
    border-color: #a78bfa;
    font-size: 1rem;
    line-height: 1.15;
    padding: 0;
    text-shadow: 0 0 10px rgba(167, 139, 250, 0.24);
}

.ci-touch-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ci-count-val {
    font-size: 1.1rem;
    /* Matched to #ci-col-index */
    font-weight: bold;
    line-height: 1.2;
    color: #4ade80;
    /* Match the "New" color for consistency? Or keep var(--accent-color)? User screenshot shows green */
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.3);
}

.ci-count-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: #94a3b8;
    margin-top: 2px;
}

.ci-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Right: Badges & Toggle */
.ci-right {
    flex: 1;
    display: flex;
    justify-content: space-between;
}

.ci-badges-area {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: center;
    /* Center rows vertically */
    height: 100%;
}

.ci-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    padding: 6px 10px 6px 10px;
    /* Uniform padding */
    border-radius: 8px;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    position: relative;
    min-width: 65px;
    margin: 8px 0;
    /* Space for top/bottom labels */
}

.ci-badge-agent {
    position: absolute;
    top: -8px;
    /* Offset to sit on the top-right border */
    right: 6px;
    font-size: 0.53rem;
    text-transform: uppercase;
    color: #fff;
    font-weight: 800;
    background: #1e293b;
    /* Backdrop */
    padding: 0 4px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2;
}

.ci-badge-days {
    position: absolute;
    bottom: -8px;
    /* Offset to sit on the bottom-left border */
    left: 6px;
    font-size: 0.53rem;
    text-transform: uppercase;
    color: #4ade80;
    /* Green highlight for "When" */
    font-weight: 800;
    background: #1e293b;
    padding: 0 4px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2;
}

.ci-badge-status {
    font-weight: 500;
}

.ci-badge-company-scope {
    border-style: dashed;
}

.ci-badge-scope {
    font-size: 0.5rem;
    line-height: 1;
    color: #facc15;
    background: rgba(250, 204, 21, 0.14);
    border: 1px solid rgba(250, 204, 21, 0.28);
    border-radius: 999px;
    padding: 1px 4px;
    margin-left: 3px;
    white-space: nowrap;
}

.ci-badge-pct {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    /* Squircle */
    padding: 1px 3px;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 2px;
}

.ci-badge-more {
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.4);
    color: #fff;
    cursor: pointer;
    font-weight: bold;
    padding-top: 4px;
    /* Override standard badge padding since no agent label */
}

.ci-badge-more:hover {
    background: rgba(255, 255, 255, 0.1);
    border-style: solid;
}

/* Reuse status colors if possible */
.ci-badge.status-positive {
    background: rgba(74, 222, 128, 0.1);
    border-color: rgba(74, 222, 128, 0.2);
    color: #86efac;
}

.ci-badge.status-neutral {
    background: rgba(250, 204, 21, 0.1);
    border-color: rgba(250, 204, 21, 0.2);
    color: #fde047;
}

.ci-badge.status-negative {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.2);
    color: #fca5a5;
}

.ci-toggle-area {
    margin-left: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-bottom: 4px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

.toggle-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Hide Active Work View Buttons */
#btn-view-day,
#btn-view-week,
#btn-view-month,
#btn-view-all {
    display: none !important;
}

/* ===== POSITIVE RESULTS BOARD (Swim-Lanes) ===== */

/* Board container - vertical stack of rows */
.pos-board {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0,0,0,0.2);
}

/* Each horizontal swim-lane row */
.pos-row {
    display: flex;
    min-height: 88px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    transition: background 0.2s ease;
}
.pos-row:last-child { border-bottom: none; }

/* Left label cell */
.pos-row-label {
    flex: 0 0 170px;
    width: 170px;
    min-width: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    background: rgba(0,0,0,0.3);
    border-right: 1px solid rgba(255,255,255,0.1);
    color: var(--text-color);
    line-height: 1.3;
    word-break: break-word;
}
.pos-row-label.label-pool {
    color: var(--accent-color);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}
.pos-row-label.label-post-positive {
    color: #c084fc;
}

/* Cards area - scrollable horizontally */
.pos-cards-area {
    flex: 1;
    display: flex;
    align-items: flex-start;
    align-content: flex-start;
    gap: 10px;
    padding: 8px 12px;
    min-height: 88px;
    flex-wrap: wrap;
}
.pos-cards-area::-webkit-scrollbar { height: 4px; }
.pos-cards-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* Drop-zone highlight while dragging over */
.pos-row.drop-active { background: rgba(192, 132, 252, 0.08); }
.pos-row.drop-active .pos-cards-area { background: rgba(192, 132, 252, 0.06); border-radius: 0 8px 8px 0; }

/* Pool drop zone highlight */
.pos-row.pool-row.drop-active { background: rgba(74, 222, 128, 0.06); }

/* Individual draggable card */
.pos-card {
    position: relative;
    flex: 0 0 auto;
    width: 145px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 26px 10px 9px 10px;
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.3s ease;
    user-select: none;
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--text-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    height: auto;
    min-height: 70px;
    word-break: break-word;
}
.pos-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
    border-color: rgba(255,255,255,0.3);
}
.pos-card:active { cursor: grabbing; }
.pos-card.dragging { opacity: 0.4; transform: scale(0.97); }
.pos-card-column {
    position: absolute;
    top: 5px;
    left: 6px;
    min-width: 28px;
    text-align: center;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0;
    color: #bfdbfe;
    background: rgba(37, 99, 235, 0.24);
    border: 1px solid rgba(147, 197, 253, 0.36);
    border-radius: 999px;
    padding: 1px 6px;
}

/* Route = primary info; wraps to show full origin → destination */
.pos-card-route   { font-weight: 700; color: #fff; font-size: 0.78rem; margin-bottom: 2px; line-height: 1.3; white-space: normal; word-break: break-word; }
/* Company = secondary, single line truncated */
.pos-card-company { color: #94a3b8; font-size: 0.65rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pos-card-type    { color: #60a5fa; font-size: 0.65rem; margin-top: 1px; }
.pos-card-status  { color: #4ade80; font-size: 0.6rem; margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-style: italic; }
.pos-card-comment { color: #a1a1aa; font-size: 0.6rem; margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-style: italic; border-top: 1px dashed rgba(255,255,255,0.1); padding-top: 2px; }

/* Timer badge — top-right corner (like contact insight badges) */
.pos-card-timer {
    position: absolute;
    top: 5px;
    right: 6px;
    font-size: 0.6rem;
    font-weight: 700;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 1px 6px;
    color: #4ade80;
    cursor: pointer;
    transition: color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
    white-space: nowrap;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}
.pos-card-timer:hover { background: rgba(255,255,255,0.12); }

/* Timer states */
.pos-card-timer.warn {
    color: #f87171;
    border-color: rgba(248,113,113,0.4);
}
.pos-card-timer.critical {
    color: #ff3b3b;
    border-color: rgba(255,59,59,0.6);
    animation: pos-card-blink 0.8s ease-in-out infinite;
}

/* Card frame blink on critical (same visual weight as plan bar 100%) */
.pos-card.timer-critical {
    animation: pos-card-blink-frame 0.8s ease-in-out infinite;
}

@keyframes pos-card-blink {
    0%   { box-shadow: none; opacity: 1; }
    50%  { box-shadow: 0 0 16px 2px rgba(255,59,59,0.9); opacity: 0.85; }
    100% { box-shadow: none; opacity: 1; }
}

@keyframes pos-card-blink-frame {
    0%   { border-color: rgba(255,59,59,0.3); box-shadow: none; }
    50%  { border-color: rgba(255,59,59,0.9); box-shadow: 0 0 18px rgba(255,59,59,0.6); }
    100% { border-color: rgba(255,59,59,0.3); box-shadow: none; }
}

/* Global Timer & Refresh Button (Header) */
.pos-global-timer-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.pos-global-timer {
    font-size: 2rem;
    font-weight: 700;
    color: #4ade80;
    padding: 6px 14px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.pos-global-timer:hover { background: rgba(255,255,255,0.1); }
.pos-global-timer.warn { color: #f87171; border-color: rgba(248,113,113,0.4); }
.pos-global-timer.critical { color: #ff3b3b; border-color: rgba(255,59,59,0.6); animation: pos-card-blink 0.8s ease-in-out infinite; }

.pos-refresh-btn {
    font-size: 0.75rem;
    color: #cbd5e1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.pos-refresh-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }


/* Global timer badge in the Positive Results header */
.pos-global-timer.warn     { color: #f87171; border-color: rgba(248,113,113,0.4); }
.pos-global-timer.critical { color: #ff3b3b; border-color: rgba(255,59,59,0.6); animation: pos-card-blink 0.8s ease-in-out infinite; }

.pos-refresh-btn {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.07);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s ease;
}
.pos-refresh-btn:hover { background: rgba(255,255,255,0.15); }

/* Transfer Button */
.pos-transfer-btn {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}
.pos-transfer-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.6);
    color: #fff;
}

/* Transfer Table */
.pos-transfer-table th { background: rgba(0,0,0,0.3); padding: 12px 10px; font-size: 0.8rem; color: #94a3b8; border-bottom: 2px solid rgba(255,255,255,0.1); text-align: left; }
.pos-transfer-table td { padding: 12px 10px; font-size: 0.85rem; border-bottom: 1px solid rgba(255,255,255,0.05); color: #fff; }
.pos-transfer-table tr:hover td { background: rgba(255,255,255,0.03); }

/* Slide-in animation for cards after status change */
@keyframes pos-card-slide-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.pos-card.slide-in { animation: pos-card-slide-in 0.25s ease; }

/* Empty drop zone placeholder text */
.pos-empty-hint {
    color: rgba(255,255,255,0.2);
    font-size: 0.7rem;
    font-style: italic;
    padding: 0 8px;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
}

/* Collapsed Mode - Hide empty rows by default */
body:not(.pos-dragging) .pos-board.collapsed .pos-row.is-empty {
    display: none;
}

/* Collapsed Mode - Show empty rows compactly when dragging */
body.pos-dragging .pos-board.collapsed {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 10px 0 20px 0;
}
body.pos-dragging .pos-board.collapsed .pos-row {
    flex-direction: column;
    height: 70px;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    overflow: hidden;
    position: relative;
    transition: all 0.2s;
}
body.pos-dragging .pos-board.collapsed .pos-row:hover,
body.pos-dragging .pos-board.collapsed .pos-row.drag-over {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.4) !important;
}
body.pos-dragging .pos-board.collapsed .pos-row-label {
    width: 100%;
    height: 100%;
    border-right: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    white-space: normal;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
    color: #fff;
}
body.pos-dragging .pos-board.collapsed .pos-row .pos-cards-area {
    height: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
}
.pos-board.collapsed .pos-card {
    min-height: 38px;
    padding: 16px 8px 6px 8px;
    width: 120px;
}
.pos-board.collapsed .pos-card-company,
.pos-board.collapsed .pos-card-type,
.pos-board.collapsed .pos-card-status,
.pos-board.collapsed .pos-card-comment {
    display: none;
}
.pos-board.collapsed .pos-card-route {
    font-size: 0.7rem;
    line-height: 1.2;
}
.pos-board.collapsed .pos-card-timer {
    top: 2px;
    right: 4px;
    font-size: 0.55rem;
    padding: 0px 4px;
}
.pos-board.collapsed .pos-card-column {
    top: 2px;
    left: 4px;
    font-size: 0.52rem;
    padding: 0px 4px;
    min-width: 24px;
}

/* --- Email Intelligence workspace --- */
.email-intel-page {
    min-height: 100vh;
}

.email-intel-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background: rgba(2, 6, 23, 0.72);
}

.email-intel-main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 28px;
    color: #f8fafc;
}

.email-intel-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding: 18px 20px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(2, 6, 23, 0.2);
}

.email-intel-topbar h1 {
    margin: 0;
    font-size: 1.7rem;
    line-height: 1.2;
}

.email-intel-topbar p {
    margin: 6px 0 0;
    color: rgba(226, 232, 240, 0.74);
}

.email-intel-tabs,
.email-intel-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    padding: 8px;
    background: rgba(15, 23, 42, 0.64);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
}

.email-intel-tabs a,
.email-intel-subtabs button,
.email-period-navigation button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 7px;
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.email-intel-tabs a:hover,
.email-intel-subtabs button:hover,
.email-period-navigation button:hover {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(96, 165, 250, 0.45);
    color: #ffffff;
}

.email-intel-tabs a.active,
.email-intel-subtabs button.active,
.email-period-navigation button.active {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(74, 222, 128, 0.48);
    color: #dcfce7;
}

.email-period-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.email-user-filter-host,
.email-intel-source-filter,
.email-intel-search,
.email-intel-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.email-intel-search input,
.email-intel-source-filter select,
.email-user-filter-host select,
.email-mirror-form input,
.email-mirror-form select,
.email-intel-settings-form input,
.email-intel-settings-form select,
.email-intel-settings-form textarea,
.email-intel-composer textarea,
.email-intel-field input,
.email-intel-field select,
.email-intel-field textarea {
    min-height: 38px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 7px;
    color: #f8fafc;
}

.email-intel-app {
    display: grid;
    gap: 16px;
}

.email-intel-panel {
    padding: 18px;
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    box-shadow: 0 16px 44px rgba(2, 6, 23, 0.18);
}

.email-db-deprecated-panel {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.email-db-deprecated-card {
    width: min(760px, 100%);
    display: grid;
    gap: 14px;
    padding: 24px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.74);
}

.email-intel-kicker {
    margin: 0;
    color: rgba(125, 211, 252, 0.9);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.email-db-deprecated-card h2 {
    margin: 0;
    font-size: 1.35rem;
}

.email-db-deprecated-card p {
    margin: 0;
    color: rgba(226, 232, 240, 0.76);
    line-height: 1.45;
}

.email-db-deprecated-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.email-intel-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.email-intel-panel-head h2,
.email-intel-panel h2 {
    margin: 0;
    font-size: 1.18rem;
    line-height: 1.3;
}

.email-intel-panel-head p,
.email-intel-panel p,
.email-intel-note,
.email-intel-empty,
.email-intel-panel small {
    color: rgba(226, 232, 240, 0.72);
}

.email-intel-card-grid,
.email-intel-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.email-intel-card-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.email-intel-card,
.email-intel-inline-card {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 14px;
    background: rgba(2, 6, 23, 0.34);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
}

.email-intel-card span,
.email-intel-inline-card span {
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.8rem;
}

.email-intel-card strong,
.email-intel-inline-card strong {
    color: #ffffff;
    font-size: 1.35rem;
}

.email-intel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.email-intel-actions.compact {
    gap: 6px;
}

.email-intel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 11px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    color: #f8fafc;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
}

.email-intel-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.22);
    border-color: rgba(96, 165, 250, 0.48);
}

.email-intel-btn.primary {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(74, 222, 128, 0.48);
    color: #dcfce7;
}

.email-intel-btn.danger {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(248, 113, 113, 0.42);
    color: #fecaca;
}

.email-intel-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.email-mirror-form,
.email-intel-settings-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
    margin: 14px 0 8px;
}

.email-mirror-form label,
.email-intel-settings-form label,
.email-intel-field {
    display: grid;
    gap: 6px;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.82rem;
}

.email-intel-panel:has([data-gmail-push-settings]) {
    max-width: 1100px;
}

.email-intel-panel:has([data-gmail-push-settings]) .email-intel-panel-head {
    align-items: center;
}

.email-intel-panel:has([data-gmail-push-settings]) .email-intel-panel-head p {
    max-width: 720px;
}

[data-gmail-push-settings].email-intel-settings-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 14px;
    max-width: 980px;
}

[data-gmail-push-settings] .email-intel-save-status {
    grid-column: 1 / -1;
    padding: 10px 12px;
    background: rgba(2, 6, 23, 0.32);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    color: rgba(226, 232, 240, 0.84);
}

[data-gmail-push-settings] .email-intel-save-status.success {
    border-color: rgba(74, 222, 128, 0.38);
    color: #dcfce7;
}

[data-gmail-push-settings] .email-intel-save-status.warning {
    border-color: rgba(251, 191, 36, 0.36);
    color: #fef3c7;
}

[data-gmail-push-settings] .email-intel-save-status.error {
    border-color: rgba(248, 113, 113, 0.4);
    color: #fecaca;
}

[data-gmail-push-settings] .email-intel-field,
[data-gmail-push-settings] .email-intel-checkline {
    min-width: 0;
}

[data-gmail-push-settings] .email-intel-field input {
    width: 100%;
    min-width: 0;
}

[data-gmail-push-settings] .email-intel-field small {
    line-height: 1.35;
}

[data-gmail-push-settings] .email-intel-checkline {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    background: rgba(2, 6, 23, 0.24);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    color: rgba(226, 232, 240, 0.82);
    line-height: 1.35;
}

[data-gmail-push-settings] .email-intel-checkline input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    min-height: 0;
    margin-top: 2px;
    padding: 0;
    accent-color: #22c55e;
}

[data-gmail-push-settings] [data-gmail-push-endpoint] {
    display: block;
    max-width: 100%;
    padding: 11px 12px;
    background: rgba(2, 6, 23, 0.36);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: #dbeafe;
    font-size: 0.8rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

[data-gmail-push-settings] .email-intel-field:has([data-gmail-push-endpoint]) {
    grid-column: 1 / -1;
}

/* Issue #5 follow-up: keep long sidebars usable and let Gmail Push fill the workspace. */
@media (min-width: 901px) {
    .sidebar {
        box-sizing: border-box;
        height: 100vh;
        max-height: 100vh;
        min-height: 0;
        overflow: hidden;
    }

    .sidebar-header,
    .sidebar-footer {
        flex: 0 0 auto;
    }

    .sidebar-nav {
        flex: 1 1 auto;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding-bottom: 8px;
        scrollbar-width: thin;
    }

    .email-intel-shell {
        height: 100vh;
        min-height: 100vh;
        overflow: hidden;
    }
}

#user-manager-modal {
    box-sizing: border-box;
    overflow: auto;
    padding: 16px;
}

#user-manager-modal .modal-content {
    margin: 0 auto;
    max-height: calc(100vh - 32px);
    overflow: hidden;
}

#user-manager-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#user-manager-modal .sidebar-settings-panel {
    min-height: 0;
    overflow: hidden;
}

#user-manager-modal .sidebar-settings-list {
    max-height: min(360px, 42vh);
    overflow-y: auto;
    padding-right: 2px;
}

.email-intel-health-section[data-health-section="push"] .email-intel-panel {
    width: 100%;
    max-width: none;
}

.email-intel-health-section[data-health-section="push"] .email-intel-panel-head {
    width: auto;
}

.email-intel-health-section[data-health-section="push"] .email-intel-panel-head p {
    max-width: min(900px, 100%);
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings].email-intel-settings-form {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    align-items: start;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-save-status,
.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-field:has([data-gmail-push-endpoint]) {
    grid-column: 1 / -1;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] [data-gmail-push-endpoint] {
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
}

/* Issue #5 final follow-up: Gmail Push alignment and sidebar/account polish. */
.email-intel-health-section[data-health-section="push"] .email-intel-panel-head {
    align-items: flex-start;
    gap: 14px;
}

.email-intel-health-section[data-health-section="push"] .email-intel-panel-head .email-intel-btn {
    flex: 0 0 auto;
    margin-top: 2px;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings].email-intel-settings-form {
    grid-template-columns: minmax(240px, 0.92fr) minmax(280px, 1.08fr);
    align-items: start;
    gap: 12px 18px;
    max-width: 920px;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-save-status {
    grid-column: 1 / -1;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-field,
.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-field input {
    min-width: 0;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-checkline {
    min-height: 34px;
    width: fit-content;
    max-width: 100%;
    padding: 3px 0;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-checkline:has([data-gmail-push-clear-token]) {
    grid-column: 2;
    margin-top: -4px;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-checkline:has([data-gmail-push-production-approval]) {
    grid-column: 1 / -1;
    width: auto;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-field:has([data-gmail-push-endpoint]) {
    grid-column: 1 / -1;
}

.email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] [data-gmail-push-endpoint] {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.45;
}

.sidebar {
    overscroll-behavior: contain;
}

.sidebar-nav {
    scrollbar-gutter: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar,
.sidebar-settings-list::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}

#user-manager-modal .modal-content {
    width: min(92vw, 680px);
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    overflow: hidden;
}

#user-manager-modal .modal-body {
    max-height: calc(100vh - 144px);
    overflow-y: auto;
}

#user-manager-modal .sidebar-settings-list {
    max-height: min(46vh, 420px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

@media (max-width: 760px) {
    .email-intel-health-section[data-health-section="push"] [data-gmail-push-settings].email-intel-settings-form {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-checkline:has([data-gmail-push-clear-token]),
    .email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-checkline:has([data-gmail-push-production-approval]),
    .email-intel-health-section[data-health-section="push"] [data-gmail-push-settings] .email-intel-field:has([data-gmail-push-endpoint]) {
        grid-column: 1;
        margin-top: 0;
    }
}

.email-intel-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
}

.email-intel-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    background: rgba(2, 6, 23, 0.24);
}

.email-intel-table th,
.email-intel-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    text-align: left;
    vertical-align: top;
}

.email-intel-table th {
    background: rgba(2, 6, 23, 0.38);
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.78rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.email-intel-table td {
    color: rgba(248, 250, 252, 0.86);
}

.email-intel-table tr:last-child td {
    border-bottom: 0;
}

.email-intel-table.compact th,
.email-intel-table.compact td {
    padding: 8px 10px;
    font-size: 0.86rem;
}

.email-intel-table small {
    display: block;
    margin-top: 3px;
    color: rgba(226, 232, 240, 0.58);
}

.email-intel-badge,
.email-intel-state-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(100, 116, 139, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.24);
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.76rem;
    font-weight: 700;
}

.email-intel-badge[data-tone="green"],
.email-intel-state-pill.success {
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(74, 222, 128, 0.38);
    color: #dcfce7;
}

.email-intel-badge[data-tone="yellow"],
.email-intel-state-pill.warning {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(251, 191, 36, 0.36);
    color: #fef3c7;
}

.email-intel-badge[data-tone="red"],
.email-intel-state-pill.danger {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(248, 113, 113, 0.38);
    color: #fecaca;
}

.email-intel-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 5px;
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.18);
    color: #bfdbfe;
    font-size: 0.72rem;
    font-weight: 800;
}

.email-intel-evidence,
.email-intel-issue-guide,
.email-intel-issue-item {
    padding: 12px;
    background: rgba(2, 6, 23, 0.26);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
}

.email-intel-composer textarea {
    width: 100%;
    min-height: 120px;
}

@media (max-width: 980px) {
    .email-intel-shell {
        display: block;
    }

    .email-intel-main {
        height: auto;
        min-height: 100vh;
        padding: 18px;
    }

    .email-intel-card-grid.three,
    .email-mirror-form,
    .email-intel-settings-form {
        grid-template-columns: 1fr;
    }

    .email-intel-panel-head,
    .email-intel-topbar {
        display: grid;
    }
}

/* Email Intelligence component contract v52.
   Keep these rules scoped to the Email Intelligence workspace so the shared
   form styles cannot stretch checkboxes, textareas, or filter menus. */
.email-intel-page .email-intel-main *,
.email-intel-page .email-intel-main *::before,
.email-intel-page .email-intel-main *::after {
    box-sizing: border-box;
}

.email-intel-page .email-intel-main input[type="checkbox"],
.email-intel-page .email-intel-main input[type="radio"] {
    width: 16px;
    min-width: 16px;
    max-width: 16px;
    height: 16px;
    min-height: 16px;
    max-height: 16px;
    flex: 0 0 16px;
    margin: 0;
    padding: 0;
    appearance: auto;
    -webkit-appearance: checkbox;
    accent-color: #22c55e;
}

.email-intel-composer {
    display: block;
    width: 100%;
    min-height: 118px;
    margin: 0;
    padding: 12px;
    resize: vertical;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    color: #f8fafc;
    font: inherit;
    line-height: 1.45;
}

.email-intel-page .email-intel-actions:not(.compact) {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(180px, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.email-intel-page .email-intel-actions select,
.email-intel-page .email-intel-actions input:not([type="checkbox"]) {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 9px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    color: #f8fafc;
}

.email-intel-badge.good,
.email-intel-badge.completed {
    background: rgba(34, 197, 94, 0.16);
    border-color: rgba(74, 222, 128, 0.38);
    color: #dcfce7;
}

.email-intel-badge.warn {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(251, 191, 36, 0.36);
    color: #fef3c7;
}

.email-intel-badge.bad {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(248, 113, 113, 0.38);
    color: #fecaca;
}

.email-period-navigation {
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.64);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.email-period-buttons,
.email-period-custom,
.email-period-stepper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.email-period-custom {
    justify-content: center;
}

.email-period-custom label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.email-period-custom input {
    width: 132px;
    min-height: 34px;
    padding: 5px 8px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    color: #f8fafc;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
}

.email-period-stepper {
    flex: 0 1 330px;
    justify-content: flex-end;
}

.email-period-stepper strong {
    min-width: 175px;
    color: #f8fafc;
    text-align: right;
    white-space: nowrap;
}

.email-user-filter-host {
    display: flex;
    justify-content: flex-end;
}

.email-user-filter {
    position: relative;
    z-index: 45;
    min-width: 210px;
    max-width: min(340px, 100%);
}

.email-user-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 38px;
    padding: 7px 11px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    color: #f8fafc;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.email-user-filter-toggle span {
    color: rgba(226, 232, 240, 0.64);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.email-user-filter-toggle strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-user-filter-menu {
    position: absolute;
    z-index: 50;
    top: calc(100% + 6px);
    right: 0;
    display: none;
    width: min(320px, 86vw);
    max-height: 330px;
    padding: 6px;
    overflow: auto;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(2, 6, 23, 0.48);
    scrollbar-width: thin;
}

.email-user-filter.open .email-user-filter-menu {
    display: grid;
    gap: 2px;
}

.email-user-filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    padding: 6px 8px;
    border-radius: 6px;
    color: rgba(248, 250, 252, 0.9);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.email-user-filter-option:hover {
    background: rgba(59, 130, 246, 0.16);
}

.email-user-filter-group-label,
.email-user-filter-empty {
    padding: 9px 8px 4px;
    color: rgba(226, 232, 240, 0.58);
    font-size: 0.72rem;
    font-weight: 800;
}

.email-user-filter-group-label {
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.email-morning-settings {
    display: grid;
    gap: 14px;
}

.email-morning-settings-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.email-morning-settings-head p {
    margin: 4px 0 0;
}

.email-morning-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr)) minmax(160px, 220px);
    gap: 10px;
    align-items: stretch;
}

.email-morning-switch,
.email-morning-time,
.email-morning-days label,
.email-morning-templates label {
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.email-morning-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    padding: 12px;
}

.email-morning-switch span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.email-morning-switch small,
.email-morning-time span,
.email-morning-templates label > span {
    color: rgba(226, 232, 240, 0.64);
    font-size: 0.75rem;
    font-weight: 700;
}

.email-morning-time {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
}

.email-morning-time input,
.email-morning-templates textarea {
    width: 100%;
    min-height: 38px;
    padding: 7px 10px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    color: #f8fafc;
    font: inherit;
}

.email-morning-days {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.email-morning-days label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 10px;
}

.email-morning-templates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.email-morning-templates label {
    display: grid;
    gap: 6px;
    padding: 10px;
}

.email-morning-templates textarea {
    min-height: 74px;
    resize: vertical;
}

.email-conversation-lookup {
    display: grid;
    grid-template-columns: minmax(260px, 460px) auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.email-conversation-lookup label {
    display: grid;
    gap: 5px;
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.email-conversation-lookup input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    color: #f8fafc;
    font: inherit;
}

.email-conversation-actions,
.email-conversation-sync-summary,
.email-conversation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.email-conversation-actions {
    justify-content: flex-end;
}

.email-conversation-sync-summary {
    margin-bottom: 12px;
}

.email-conversation-sync-summary span,
.email-conversation-meta span {
    padding: 5px 8px;
    background: rgba(2, 6, 23, 0.3);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.75rem;
    font-weight: 700;
}

.email-conversation-sync-summary span.danger,
.email-conversation-sync-errors {
    background: rgba(127, 29, 29, 0.24);
    border-color: rgba(248, 113, 113, 0.38);
    color: #fecaca;
}

.email-conversation-sync-errors {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-style: solid;
    border-width: 1px;
    border-radius: 8px;
}

.email-conversation-sync-errors p {
    margin: 0;
    overflow-wrap: anywhere;
}

.email-conversation-list {
    display: grid;
    gap: 12px;
}

.email-conversation-tile {
    display: grid;
    gap: 12px;
    padding: 14px;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.email-conversation-tile-head,
.email-conversation-message > div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.email-conversation-tile-head strong {
    display: block;
    font-size: 1.05rem;
}

.email-conversation-tile-head small,
.email-conversation-message span,
.email-conversation-message small {
    color: rgba(226, 232, 240, 0.62);
    overflow-wrap: anywhere;
}

.email-conversation-messages {
    display: grid;
    gap: 8px;
}

.email-conversation-message {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.7);
    border-left: 3px solid #94a3b8;
}

.email-conversation-message.inbound {
    background: rgba(120, 53, 15, 0.2);
    border-left-color: #f59e0b;
}

.email-conversation-message.outbound {
    background: rgba(30, 64, 175, 0.2);
    border-left-color: #60a5fa;
}

.email-conversation-message p {
    margin: 0;
    color: rgba(248, 250, 252, 0.86);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.email-followup-stage-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.email-followup-stage-card {
    display: grid;
    grid-template-columns: minmax(180px, 0.85fr) minmax(280px, 1.6fr);
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.email-followup-stage-card.is-ready-to-send {
    background: rgba(120, 53, 15, 0.2);
    border-color: rgba(251, 191, 36, 0.48);
}

.email-followup-stage-card > div:first-child {
    display: grid;
    gap: 4px;
}

.email-followup-stage-card span,
.email-followup-stage-card small {
    color: rgba(226, 232, 240, 0.64);
    font-size: 0.75rem;
}

.email-followup-stage-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.email-followup-stage-metrics div {
    display: grid;
    align-content: center;
    gap: 3px;
    min-height: 62px;
    padding: 9px 10px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
}

.email-followup-stage-metrics strong {
    font-size: 1.35rem;
    line-height: 1;
}

.answer-layer-list {
    display: grid;
    gap: 12px;
}

.answer-layer-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.answer-layer-meta {
    display: grid;
    grid-template-columns: 110px minmax(180px, 1fr) 120px;
    align-items: end;
    gap: 10px;
}

.answer-layer-card label {
    display: grid;
    gap: 5px;
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.answer-layer-card input,
.answer-layer-card textarea {
    width: 100%;
    padding: 8px 9px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 7px;
    color: #f8fafc;
    font: inherit;
    line-height: 1.35;
    text-transform: none;
}

.answer-layer-card textarea {
    min-height: 70px;
    resize: vertical;
}

.answer-layer-active {
    display: flex !important;
    grid-auto-flow: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px !important;
    min-height: 34px;
    padding: 8px 9px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 7px;
}

.email-qa-method {
    display: grid;
    gap: 14px;
}

.email-qa-method code {
    width: fit-content;
    max-width: 100%;
    padding: 8px 10px;
    overflow-wrap: anywhere;
    background: rgba(2, 6, 23, 0.32);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 7px;
    color: #dbeafe;
}

.email-training-modules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.email-training-module {
    padding: 12px;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.email-training-module strong {
    display: block;
    margin-bottom: 5px;
}

.email-training-module p {
    margin: 0;
    color: rgba(226, 232, 240, 0.72);
    line-height: 1.4;
}

.email-dialogue-plan,
.email-customer-context {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.email-dialogue-plan h3,
.email-customer-context h3 {
    margin: 0 0 5px;
    color: #f8fafc;
    font-size: 0.94rem;
}

.email-customer-context p {
    margin: 0;
    color: rgba(226, 232, 240, 0.68);
}

.email-customer-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.email-customer-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 8px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    color: rgba(226, 232, 240, 0.58);
}

.email-customer-check.known {
    color: #f8fafc;
}

.email-customer-checkmark {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 4px;
    color: #4ade80;
    font-size: 0.7rem;
}

.email-customer-checkmark.empty {
    color: transparent;
}

.email-dialogue-steps {
    display: grid;
    gap: 8px;
}

.email-dialogue-step {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
}

.email-dialogue-step.current {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.52);
}

.email-dialogue-step > span {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    background: #334155;
    border-radius: 8px;
    color: #fff;
    font-weight: 800;
}

.email-dialogue-step strong {
    display: block;
    color: #f8fafc;
}

.email-dialogue-step small {
    display: inline-block;
    margin-top: 2px;
    color: #93c5fd;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.email-dialogue-step p {
    margin: 5px 0 0;
    color: rgba(226, 232, 240, 0.66);
    line-height: 1.35;
}

.email-smart-replies {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.email-smart-chip {
    min-height: 78px;
    padding: 11px 12px;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    color: #e2e8f0;
    font: inherit;
    line-height: 1.35;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.email-smart-chip:hover {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.52);
}

.email-intel-issue-guide {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    padding: 0;
    background: transparent;
    border: 0;
}

.email-intel-issue-item {
    display: grid;
    gap: 6px;
}

.email-intel-issue-item div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.email-intel-issue-item strong {
    color: #f8fafc;
}

.email-intel-issue-item span:not(.email-intel-info-icon) {
    width: 100%;
    color: rgba(226, 232, 240, 0.62);
}

.email-intel-issue-item p {
    margin: 0;
    color: rgba(226, 232, 240, 0.72);
    line-height: 1.35;
}

.email-intel-state-pill.neutral {
    color: rgba(226, 232, 240, 0.68);
}

.email-intel-pagination-summary {
    min-width: 116px;
    text-align: right;
}

.email-ambiguous-list,
.email-ambiguous-candidates {
    display: grid;
    gap: 12px;
}

.email-ambiguous-item,
.email-ambiguous-candidate {
    display: grid;
    gap: 12px;
    padding: 14px;
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
}

.email-ambiguous-context {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
    align-items: center;
    gap: 12px;
}

.email-ambiguous-candidate {
    grid-template-columns: minmax(220px, 1fr) minmax(200px, 1.4fr) minmax(180px, 1fr) auto;
    align-items: center;
    padding: 12px;
}

.email-ambiguous-context strong,
.email-ambiguous-context span,
.email-ambiguous-context small,
.email-ambiguous-candidate strong,
.email-ambiguous-candidate p {
    display: block;
    overflow-wrap: anywhere;
}

.email-ambiguous-context strong,
.email-ambiguous-candidate strong {
    color: #f8fafc;
}

.email-ambiguous-context span,
.email-ambiguous-candidate p {
    color: #e2e8f0;
}

.email-ambiguous-context small,
.email-ambiguous-candidate small {
    color: rgba(226, 232, 240, 0.58);
}

@media (max-width: 1100px) {
    .answer-layer-meta,
    .email-followup-stage-card,
    .email-followup-stage-metrics,
    .email-smart-replies,
    .email-ambiguous-context,
    .email-ambiguous-candidate,
    .email-intel-page .email-intel-actions:not(.compact) {
        grid-template-columns: 1fr;
    }

    .email-conversation-lookup {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .email-period-navigation {
        display: grid;
        align-items: stretch;
    }

    .email-period-custom {
        justify-content: flex-start;
    }

    .email-period-stepper {
        flex: none;
        justify-content: space-between;
    }

    .email-period-stepper strong {
        min-width: 0;
        text-align: left;
    }

    .email-morning-settings-head,
    .email-morning-controls {
        display: grid;
        grid-template-columns: 1fr;
    }

    .email-intel-pagination-summary {
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 760px) {
    .email-user-filter-host,
    .email-user-filter {
        width: 100%;
        max-width: none;
    }

    .email-user-filter-menu {
        right: auto;
        left: 0;
        width: min(100%, calc(100vw - 36px));
    }

    .email-conversation-tile-head,
    .email-conversation-message > div {
        display: grid;
    }

    .email-period-custom label {
        width: 100%;
        justify-content: space-between;
    }

    .email-period-custom input {
        width: min(180px, 55vw);
    }
}

/* --- Phase 1 Nonconformity Logging --- */
.nonconf-content {
    min-width: 0;
}

.nonconf-page-header {
    align-items: flex-start;
    gap: 16px;
}

.nonconf-page-subtitle {
    margin: 4px 0 0;
    color: rgba(248, 250, 252, 0.72);
    font-size: 0.95rem;
}

.nonconf-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nonconf-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.nonconf-summary-card {
    background: rgba(15, 23, 42, 0.74);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    padding: 14px 16px;
    min-height: 86px;
}

.nonconf-summary-card span {
    display: block;
    color: rgba(248, 250, 252, 0.68);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.nonconf-summary-card strong {
    display: block;
    margin-top: 10px;
    font-size: 1.7rem;
    color: #f8fafc;
}

.nonconf-dev-rule-panel {
    background: rgba(20, 83, 45, 0.16);
    border: 1px solid rgba(74, 222, 128, 0.32);
    border-radius: 8px;
    color: rgba(240, 253, 244, 0.92);
    padding: 12px 14px;
}

.nonconf-dev-rule-panel summary {
    cursor: pointer;
    font-weight: 700;
}

.nonconf-dev-rule-panel p {
    margin: 10px 0;
}

.nonconf-dev-rule-panel ul {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 10px 0;
    padding-left: 18px;
}

.nonconf-dev-rule-panel pre {
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
    background: rgba(2, 6, 23, 0.36);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 6px;
    color: #dcfce7;
    padding: 10px;
}

.nonconf-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) repeat(5, minmax(130px, 1fr)) auto auto;
    gap: 10px;
    align-items: center;
    background: rgba(15, 23, 42, 0.66);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    padding: 12px;
}

.nonconf-toolbar input,
.nonconf-toolbar select,
.nonconf-form input,
.nonconf-form select,
.nonconf-form textarea,
.nonconf-inline-form input,
.nonconf-inline-form select,
.nonconf-inline-form textarea,
.nonconf-link-form input {
    width: 100%;
    min-height: 38px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    color: #f8fafc;
    padding: 8px 10px;
    font: inherit;
}

.nonconf-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
    gap: 16px;
    align-items: start;
}

.nonconf-list-panel,
.nonconf-detail-panel {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    min-width: 0;
}

.nonconf-table-wrap {
    overflow: auto;
    max-height: calc(100vh - 330px);
}

.nonconf-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.nonconf-table th,
.nonconf-table td {
    padding: 11px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    text-align: left;
    vertical-align: top;
}

.nonconf-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #111827;
    color: rgba(248, 250, 252, 0.76);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.nonconf-table tr {
    cursor: pointer;
}

.nonconf-table tr:hover td,
.nonconf-table tr.selected td {
    background: rgba(59, 130, 246, 0.12);
}

.nonconf-table td strong {
    display: block;
    max-width: 360px;
}

.nonconf-table td small {
    display: block;
    margin-top: 4px;
    color: rgba(248, 250, 252, 0.58);
}

.nonconf-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: #f8fafc;
    font-size: 0.72rem;
    line-height: 1.2;
    white-space: nowrap;
}

.nonconf-severity-s0,
.nonconf-severity-s1 {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(248, 113, 113, 0.42);
}

.nonconf-severity-s2 {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(251, 191, 36, 0.36);
}

.nonconf-severity-s3 {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(74, 222, 128, 0.32);
}

.nonconf-severity-s4 {
    background: rgba(100, 116, 139, 0.18);
    border-color: rgba(148, 163, 184, 0.32);
}

.nonconf-priority-p0,
.nonconf-priority-p1 {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(248, 113, 113, 0.42);
}

.nonconf-priority-p2 {
    background: rgba(245, 158, 11, 0.18);
    border-color: rgba(251, 191, 36, 0.36);
}

.nonconf-priority-p3 {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(96, 165, 250, 0.34);
}

.nonconf-priority-p4 {
    background: rgba(100, 116, 139, 0.18);
    border-color: rgba(148, 163, 184, 0.32);
}

.nonconf-status-verified,
.nonconf-status-fixed {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(74, 222, 128, 0.36);
}

.nonconf-status-rejected,
.nonconf-status-duplicate,
.nonconf-status-wont-fix,
.nonconf-status-accepted-risk {
    background: rgba(100, 116, 139, 0.25);
}

.nonconf-status-confirmed,
.nonconf-status-in-progress {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.36);
}

.nonconf-status-new,
.nonconf-status-needs-review,
.nonconf-status-ready-for-verification,
.nonconf-status-waiting-for-info {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(251, 191, 36, 0.34);
}

.nonconf-detail-panel {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 150px);
    overflow: auto;
    padding: 16px;
}

.nonconf-empty,
.nonconf-muted {
    color: rgba(248, 250, 252, 0.62);
}

.nonconf-detail-header {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.nonconf-detail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nonconf-detail-header h2 {
    margin: 10px 0 4px;
    font-size: 1.15rem;
    line-height: 1.35;
}

.nonconf-detail-header p {
    color: rgba(248, 250, 252, 0.64);
    margin: 0;
}

.nonconf-detail-section {
    padding: 15px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.nonconf-detail-section h3 {
    margin: 0 0 10px;
    font-size: 0.92rem;
}

.nonconf-detail-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 9px;
}

.nonconf-detail-row span {
    color: rgba(248, 250, 252, 0.58);
    font-size: 0.78rem;
}

.nonconf-detail-row p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.nonconf-timestamp {
    white-space: nowrap;
}

.ls-et-timestamp {
    white-space: nowrap;
    cursor: help;
}

.nonconf-inline-form,
.nonconf-link-form {
    display: grid;
    gap: 8px;
}

.nonconf-link-form {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.nonconf-comments,
.nonconf-links,
.nonconf-audit {
    display: grid;
    gap: 8px;
}

.nonconf-comment,
.nonconf-link-row,
.nonconf-audit li {
    background: rgba(2, 6, 23, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 6px;
    padding: 10px;
}

.nonconf-comment header,
.nonconf-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.nonconf-link-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.nonconf-comment header span,
.nonconf-audit span,
.nonconf-link-main small {
    color: rgba(248, 250, 252, 0.56);
    font-size: 0.76rem;
}

.nonconf-comment p,
.nonconf-audit p {
    margin: 8px 0 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.nonconf-audit {
    padding-left: 18px;
}

.nonconf-warning {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(251, 191, 36, 0.36);
    border-radius: 8px;
    color: #fde68a;
    margin-bottom: 12px;
    padding: 10px 12px;
}

.nonconf-warning strong {
    display: block;
    margin-bottom: 4px;
}

.nonconf-warning p {
    margin: 0;
    color: rgba(254, 243, 199, 0.88);
    overflow-wrap: anywhere;
}

.nonconf-postlog-form {
    display: grid;
    gap: 10px;
}

.nonconf-postlog-field {
    display: grid;
    gap: 6px;
    color: rgba(248, 250, 252, 0.78);
    font-size: 0.82rem;
}

.nonconf-postlog-field textarea,
.nonconf-postlog-field select {
    width: 100%;
    min-height: 38px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 6px;
    color: #f8fafc;
    padding: 8px 10px;
    font: inherit;
}

.nonconf-postlog-field span {
    color: rgba(248, 250, 252, 0.58);
    font-size: 0.76rem;
}

.nonconf-postlog-actions {
    display: flex;
    justify-content: flex-end;
}

.nonconf-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: rgba(248, 250, 252, 0.64);
}

.nonconf-context-button {
    position: relative;
    z-index: 2147483100;
    margin-right: 10px;
}

.nonconf-topbar-actions {
    margin-left: auto;
}

.nonconf-primary-action {
    background: rgba(74, 222, 128, 0.16);
    border-color: rgba(74, 222, 128, 0.42);
}

.nonconf-danger {
    border-color: rgba(248, 113, 113, 0.5);
    color: #fecaca;
}

.nonconf-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.72);
    padding: 20px;
}

.nonconf-modal.open {
    display: flex;
}

.nonconf-modal-dialog {
    width: min(860px, 96vw);
    max-height: 90vh;
    overflow: auto;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.nonconf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.nonconf-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.nonconf-modal-close {
    background: transparent;
    border: 0;
    color: #f8fafc;
    font-size: 1.7rem;
    cursor: pointer;
}

.nonconf-form {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.nonconf-form-intro,
.nonconf-scale-guide {
    margin: 0;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 6px;
    color: rgba(219, 234, 254, 0.9);
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 10px 12px;
}

.nonconf-form label {
    display: grid;
    gap: 6px;
    color: rgba(248, 250, 252, 0.76);
    font-size: 0.82rem;
}

.nonconf-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.nonconf-field-help {
    color: rgba(203, 213, 225, 0.66);
    font-size: 0.74rem;
    line-height: 1.35;
}

.nonconf-privacy-note {
    margin: 0;
    color: rgba(248, 250, 252, 0.64);
    font-size: 0.8rem;
}

.nonconf-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.nonconf-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1400;
    max-width: min(420px, calc(100vw - 36px));
    padding: 12px 14px;
    background: #111827;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 8px;
    color: #f8fafc;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.nonconf-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.nonconf-toast[data-kind="error"] {
    border-color: rgba(248, 113, 113, 0.48);
}

.nonconf-toast[data-kind="success"] {
    border-color: rgba(74, 222, 128, 0.44);
}

body.medieval .nonconf-summary-card,
body.medieval .nonconf-toolbar,
body.medieval .nonconf-list-panel,
body.medieval .nonconf-detail-panel,
body.medieval .nonconf-modal-dialog {
    background: rgba(255, 248, 220, 0.96);
    color: #3e2723;
}

body.medieval .nonconf-toolbar input,
body.medieval .nonconf-toolbar select,
body.medieval .nonconf-form input,
body.medieval .nonconf-form select,
body.medieval .nonconf-form textarea,
body.medieval .nonconf-inline-form input,
body.medieval .nonconf-inline-form select,
body.medieval .nonconf-inline-form textarea,
body.medieval .nonconf-link-form input {
    background: #fff8dc;
    color: #3e2723;
    border-color: #8d6e63;
}

body.medieval .nonconf-table th {
    background: #5d4037;
}

@media (max-width: 1180px) {
    .nonconf-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nonconf-toolbar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nonconf-workspace {
        grid-template-columns: 1fr;
    }

    .nonconf-detail-panel {
        position: static;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .nonconf-summary-grid,
    .nonconf-toolbar,
    .nonconf-form-grid,
    .nonconf-link-form {
        grid-template-columns: 1fr;
    }

    .nonconf-dev-rule-panel ul {
        grid-template-columns: 1fr;
    }

    .nonconf-detail-row {
        grid-template-columns: 1fr;
    }

    .nonconf-modal {
        padding: 10px;
    }
}


/* Issue #11: secure database backup status panel */
.admin-backup-panel {
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-color);
}

.admin-backup-panel[hidden] {
    display: none !important;
}

.database-export-safety-note {
    display: grid;
    gap: 0.45rem;
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.08);
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.45;
}

.database-export-safety-note p {
    margin: 0;
}

.database-export-safety-note strong {
    color: var(--primary-color);
}

.admin-backup-summary {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.admin-backup-summary h2 {
    margin: 0 0 4px;
    font-size: 1rem;
    line-height: 1.2;
    letter-spacing: 0;
}

.admin-backup-summary p,
.admin-backup-warning,
.admin-backup-local p {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.35;
}

.admin-backup-badge {
    flex: 0 0 auto;
    padding: 5px 8px;
    border: 1px solid rgba(248, 113, 113, 0.38);
    border-radius: 999px;
    background: rgba(127, 29, 29, 0.18);
    color: #fecaca;
    font-size: 0.75rem;
    font-weight: 800;
}

.admin-backup-warning {
    padding: 9px 10px;
    border: 1px solid rgba(250, 204, 21, 0.32);
    border-radius: 8px;
    background: rgba(113, 63, 18, 0.18);
    color: #fde68a;
}

.admin-backup-preflight {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.admin-backup-preflight div {
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.22);
}

.admin-backup-preflight dt {
    margin: 0 0 3px;
    color: rgba(226, 232, 240, 0.68);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-backup-preflight dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 0.82rem;
    line-height: 1.3;
}

.admin-backup-local summary {
    cursor: pointer;
    font-weight: 800;
    font-size: 0.84rem;
}

.admin-backup-local pre {
    margin: 8px 0;
    padding: 10px;
    max-width: 100%;
    overflow: auto;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.46);
    color: #cbd5e1;
    font-size: 0.78rem;
    white-space: pre-wrap;
}

.admin-backup-local ul {
    margin: 8px 0 0 18px;
    padding: 0;
    font-size: 0.82rem;
    line-height: 1.35;
}

@media (max-width: 1100px) {
    .admin-backup-preflight {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .admin-backup-summary {
        flex-direction: column;
    }

    .admin-backup-preflight {
        grid-template-columns: 1fr;
    }
}

.active-work-save-saving {
    outline: 2px solid rgba(255, 184, 0, 0.7) !important;
    outline-offset: -2px;
}

.active-work-save-saved {
    outline: 2px solid rgba(0, 210, 106, 0.75) !important;
    outline-offset: -2px;
}

.active-work-save-error,
.active-work-save-conflict {
    outline: 2px solid rgba(255, 76, 76, 0.85) !important;
    outline-offset: -2px;
}

.active-work-save-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 10030;
    max-width: min(420px, calc(100vw - 44px));
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(20, 24, 32, 0.96);
    color: #f5f7fb;
    font-size: 0.88rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.active-work-save-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.active-work-save-toast.is-error,
.active-work-save-toast.is-conflict {
    border-color: rgba(255, 76, 76, 0.5);
}
