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

body {
    font-family: var(--font-family);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-accent-hover);
}

input, button, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input[type="text"], input[type="email"], input[type="password"], textarea, select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background-color: var(--color-bg-primary);
    outline: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    color: var(--color-text-primary);
}

input:focus, textarea:focus, select:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.12);
}

button {
    background-color: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    color: var(--color-btn-text);
    padding: 7px 14px;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

button:hover {
    background-color: var(--color-btn-hover);
    border-color: var(--color-border-dark);
}

button.primary {
    background-color: var(--color-accent);
    color: #ffffff;
    border-color: var(--color-accent);
    box-shadow: 0 2px 5px rgba(0, 102, 204, 0.2);
}

button.primary:hover {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    box-shadow: 0 3px 8px rgba(0, 102, 204, 0.3);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d3d3d0;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #b0b0ad;
}

/* Main Layout Structure */
#app-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--color-bg-primary);
}

/* ────────────────────────────────────────────────────────────
   SIDEBAR — Google Workspace Premium White Theme
   ──────────────────────────────────────────────────────────── */
/* ────────────────────────────────────────────────────────────
   GOOGLE WORKSPACE TOP NAVBAR — Gmail / Material Design 3
   ──────────────────────────────────────────────────────────── */
.google-top-navbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 20px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(15,23,42,0.03);
    z-index: 90;
}

.g-nav-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.g-breadcrumb {
    display: flex;
    align-items: center;
    font-size: 13.5px;
    color: #475569;
}

.g-search-bar {
    flex: 1;
    max-width: 680px;
    position: relative;
    display: flex;
    align-items: center;
    background: #eaf1fb;
    border-radius: 28px;
    padding: 0 18px;
    height: 44px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.g-search-bar:focus-within {
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 4px 18px rgba(37,99,235,0.12);
}

.g-search-icon {
    color: #444746;
    font-size: 15px;
    margin-right: 12px;
}

.g-search-bar input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    height: 100% !important;
    padding: 0 !important;
    font-size: 14px;
    color: #1f1f1f;
    outline: none;
    flex: 1;
}

.g-search-filter-trigger {
    background: transparent;
    border: none;
    color: #444746;
    font-size: 14px;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: none;
}

.g-search-filter-trigger:hover {
    background: rgba(0,0,0,0.06);
    color: #1a73e8;
}

.g-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.g-clock-pill {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.g-status-badge {
    font-size: 11.5px;
    font-weight: 700;
    color: #16a34a;
    background: #f0fdf4;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #bbf7d0;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* DEMO MODE Announcement Pill */
.demo-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border: 1px solid #fdba74;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    color: #c2410c;
    letter-spacing: 0.6px;
    box-shadow: 0 1px 4px rgba(249, 115, 22, 0.15);
    white-space: nowrap;
    user-select: none;
}

.demo-mode-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ea580c;
    display: inline-block;
    animation: demoPulse 1.8s infinite ease-in-out;
}

@keyframes demoPulse {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

.dashboard-middle-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1100px) {
    .dashboard-middle-row {
        grid-template-columns: 1fr !important;
    }
}

.g-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #444746;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s ease;
}

.g-icon-btn:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.g-profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-weight: 700;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}

/* ────────────────────────────────────────────────────────────
   SIDEBAR — Google Workspace Gmail Pill Style
   ──────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    background: #ffffff;
    border-right: 1px solid #e8eaed;
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 1px 0 0 0 #e8eaed;
}

.sidebar-brand {
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
}

.g-compose-pill-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    background: #c2e7ff;
    color: #001d35;
    border: none;
    border-radius: 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    width: calc(100% - 24px);
    margin: 14px 12px 6px 12px;
}

.g-compose-pill-btn:hover {
    background: #b3e0ff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0;
    margin: 0;
}

.sidebar-menu-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    padding: 14px 14px 6px 14px;
    margin: 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    color: #444746;
    cursor: pointer;
    border-radius: 24px;
    transition: all 0.15s ease;
    text-decoration: none;
    position: relative;
    user-select: none;
}

.sidebar-nav-item .nav-icon-wrap {
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav-item i {
    font-size: 16px;
    color: #444746;
    transition: color 0.15s ease;
}

.sidebar-nav-item:hover {
    background: #f0f4f9;
    color: #001d35;
}

.sidebar-nav-item:hover i {
    color: #0b57d0;
}

.sidebar-nav-item.active {
    background: #c2e7ff;
    color: #001d35;
    font-weight: 700;
}

.sidebar-nav-item.active i {
    color: #001d35;
}

/* ────────────────────────────────────────────────────────────
   RESPONSIVE COLLAPSIBLE SIDEBAR
   ──────────────────────────────────────────────────────────── */
.sidebar {
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 72px !important;
    overflow: visible !important;
    z-index: 1000 !important;
}

.sidebar.collapsed .sidebar-nav-scroll {
    overflow: visible !important;
}

.sidebar.collapsed .sidebar-menu li {
    position: relative !important;
    z-index: 1001 !important;
}

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .g-compose-pill-btn span,
.sidebar.collapsed .sidebar-menu-label,
.sidebar.collapsed .sidebar-nav-item > span:not(.nav-icon-wrap),
.sidebar.collapsed .sidebar-footer .sidebar-user-info {
    display: none !important;
}

.sidebar.collapsed .sidebar-footer {
    padding: 12px 6px !important;
}

.sidebar.collapsed .sidebar-user-card {
    justify-content: center !important;
    padding: 6px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.sidebar.collapsed .sidebar-user-avatar {
    display: none !important;
}

.sidebar.collapsed #sidebar-logout {
    margin: 0 auto !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sidebar.collapsed .nav-icon-wrap {
    display: inline-flex !important;
    margin: 0 !important;
}

.sidebar.collapsed .g-compose-pill-btn {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 50% !important;
    margin: 14px auto 6px auto !important;
}

.sidebar.collapsed .sidebar-nav-item {
    justify-content: center !important;
    padding: 12px !important;
    border-radius: 24px !important;
    position: relative !important;
}

.sidebar.collapsed .sidebar-nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 8px 24px rgba(15,23,42,0.25);
    z-index: 99999 !important;
}

.sidebar.collapsed .sidebar-nav-item::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent #0f172a transparent transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 99999 !important;
}

.sidebar.collapsed .sidebar-nav-item:hover::after,
.sidebar.collapsed .sidebar-nav-item:hover::before {
    opacity: 1 !important;
    visibility: visible !important;
}

.sidebar-nav-item .nav-badge {
    margin-left: auto;
    background: #d93025;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.sidebar-footer {
    padding: 10px 12px 14px;
    border-top: 1px solid #f1f3f4;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    transition: background 0.12s;
}

.sidebar-user-card:hover {
    background: #f1f3f4;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-weight: 700;
    color: #1a1a2e;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 10.5px;
    color: #5f6368;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer button {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    color: #5f6368;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sidebar-footer button:hover {
    background: #fce8e6;
    color: #d93025;
    border-color: #f5c6c2;
}

.main-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    background-color: var(--color-bg-primary);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-small);
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.badge.success {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success-border);
}

.badge.warning {
    background-color: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.badge.danger {
    background-color: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error-border);
}

/* Modal Overlay Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 15, 15, 0.4);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive sidebar support */
@media (max-width: 900px) {
    .sidebar {
        width: 70px;
        padding: 16px 8px;
    }
    .sidebar-brand span, .sidebar-nav-item span, .sidebar-footer {
        display: none;
    }
    .sidebar-nav-item {
        justify-content: center;
        padding: 12px;
    }
    .main-content {
        padding: 20px;
    }
}

/* Advanced Search Preset Pills */
.adv-preset-pill {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.adv-preset-pill:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    transform: translateY(-1px);
}
