/* WBSIN Management System - Professional Mobile-First CSS */

:root {
    /* Color Palette - Warm & Professional */
    --primary-color: #4f6ef7;
    --primary-hover: #3b5de5;
    --primary-light: #eef2ff;
    --secondary-color: #6b7280;
    --secondary-hover: #4b5563;
    --success-color: #059669;
    --success-light: #d1fae5;
    --error-color: #dc2626;
    --error-light: #fee2e2;
    --warning-color: #d97706;
    --warning-light: #fef3c7;
    --info-color: #0891b2;
    --info-light: #cffafe;

    /* Neutral Colors - Warm Tones */
    --bg-color: #f8f7f4;
    --card-bg: #ffffff;
    --text-color: #1a1a2e;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e2dc;
    --border-light: #f5f3ef;

    /* Sidebar */
    --sidebar-bg: #1e2235;
    --sidebar-text: #c8cad3;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: rgba(79, 110, 247, 0.15);
    --sidebar-divider: rgba(255, 255, 255, 0.06);

    /* Layout */
    --sidebar-width: 250px;
    --sidebar-collapsed: 70px;
    --header-height: 64px;
    --border-radius: 10px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Shadows - Softer */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f1117;
        --card-bg: #1a1d2e;
        --text-color: #e8e8ed;
        --text-muted: #9ca3af;
        --text-light: #6b7280;
        --border-color: #2d3044;
        --border-light: #1e2133;
        --sidebar-bg: #12141f;
    }
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14.5px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: transform var(--transition-slow);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
}

.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-divider);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #4f6ef7 0%, #7c5cfc 100%);
    color: #fff;
    font-size: 1.125rem;
    font-weight: 800;
    border-radius: 12px;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 10px rgba(79, 110, 247, 0.35);
}

.sidebar-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(79, 110, 247, 0.45);
}

.sidebar-logo svg {
    width: 22px;
    height: 22px;
}

.workspace-toggle {
    width: 100%;
}

.workspace-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    color: var(--sidebar-text);
}

.workspace-btn:hover {
    border-color: rgba(79, 110, 247, 0.4);
    background: rgba(79, 110, 247, 0.1);
}

.workspace-btn.workspace-company {
    border-color: rgba(79, 110, 247, 0.3);
    color: #8ba3f9;
}

.workspace-btn.workspace-personal {
    border-color: rgba(5, 150, 105, 0.3);
    color: #6ee7b7;
    background: rgba(5, 150, 105, 0.1);
}

.workspace-icon {
    font-size: 1rem;
}

.workspace-label {
    flex: 1;
    text-align: left;
}

.nav-divider {
    padding: 1rem 1.25rem 0.35rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.3);
}

.nav-divider-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    transition: color 0.2s;
}

.nav-divider-toggle:hover {
    color: rgba(255, 255, 255, 0.5);
}

.nav-divider-arrow {
    transition: transform 0.2s;
}

.nav-divider-toggle.collapsed .nav-divider-arrow {
    transform: rotate(-90deg);
}

.nav-collapsible {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease;
}

.nav-collapsible.collapsed {
    max-height: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.55rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-weight: 500;
    font-size: 0.8625rem;
    margin: 0 0.5rem;
    border-radius: var(--border-radius-sm);
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--sidebar-text-hover);
}

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: #8ba3f9;
}

.nav-icon {
    margin-right: 0.75rem;
    font-size: 1.125rem;
    width: 1.5rem;
    text-align: center;
    opacity: 0.8;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--sidebar-divider);
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-footer .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
}

.sidebar-footer .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--sidebar-text-hover);
}

.user-info {
    margin-bottom: 0.75rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.125rem;
    color: #e8e8ed;
}

.user-role {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: capitalize;
}

/* ==================== MOBILE MENU ==================== */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.625rem;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text-color);
    transition: all var(--transition);
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-slow);
    overflow-x: hidden;
}

.content-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.content-header h2 {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-color);
    flex: 1;
    min-width: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.content-body {
    flex: 1;
    padding: 1.5rem;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary-color); }
.stat-icon.success { background: var(--success-light); color: var(--success-color); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning-color); }
.stat-icon.error { background: var(--error-light); color: var(--error-color); }
.stat-icon.info { background: var(--info-light); color: var(--info-color); }

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.stat-trend {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-trend.up { color: var(--success-color); }
.stat-trend.down { color: var(--error-color); }

/* ==================== PROGRESS COMPONENTS ==================== */
.progress-bar-container {
    background: var(--border-color);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width var(--transition-slow);
}

.progress-bar.primary { background: var(--primary-color); }
.progress-bar.success { background: var(--success-color); }
.progress-bar.warning { background: var(--warning-color); }
.progress-bar.error { background: var(--error-color); }

.progress-circle {
    width: 80px;
    height: 80px;
    position: relative;
}

.progress-circle svg {
    transform: rotate(-90deg);
}

.progress-circle-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.progress-circle-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--transition-slow);
}

.progress-circle-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 700;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 1.125rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group label .required {
    color: var(--error-color);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.9375rem;
    transition: all var(--transition);
    background: var(--card-bg);
    color: var(--text-color);
    line-height: 1.5;
}

.form-control:hover {
    border-color: #c5c2bb;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.form-control::placeholder {
    color: var(--text-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-control-static {
    padding: 0.625rem 0;
    font-size: 0.9375rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--error-color);
    margin-top: 0.375rem;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.125rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: 0 1px 3px rgba(79, 110, 247, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), #2a4ed4);
    box-shadow: 0 2px 6px rgba(79, 110, 247, 0.35);
}

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

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background: var(--border-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--border-light);
    color: var(--text-color);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
    padding: 0.25rem;
}

/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1rem 0;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    background: var(--border-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition);
    min-width: 80px;
    cursor: pointer;
}

.quick-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

.quick-action-btn .icon {
    font-size: 1.25rem;
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9375rem;
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border: 1px solid var(--success-color);
}

.alert-error {
    background-color: var(--error-light);
    color: #991b1b;
    border: 1px solid var(--error-color);
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400e;
    border: 1px solid var(--warning-color);
}

.alert-info {
    background-color: var(--info-light);
    color: #0e7490;
    border: 1px solid var(--info-color);
}

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #fed7aa; color: #9a3412; }
.badge-purple { background: #e9d5ff; color: #6b21a8; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-cyan { background: #cffafe; color: #0e7490; }

/* ==================== TABLES ==================== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    font-size: 0.875rem;
}

table th,
table td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background-color: var(--border-light);
    white-space: nowrap;
}

table tbody tr {
    transition: background-color var(--transition-fast);
}

table tbody tr:hover {
    background-color: var(--border-light);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ==================== NOTES ==================== */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.note-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    transition: all var(--transition);
    position: relative;
}

.note-card:hover {
    box-shadow: var(--shadow-md);
}

.note-card.pinned {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, var(--warning-light) 0%, var(--card-bg) 100%);
}

.note-card.color-blue { border-left: 4px solid var(--primary-color); }
.note-card.color-green { border-left: 4px solid var(--success-color); }
.note-card.color-yellow { border-left: 4px solid var(--warning-color); }
.note-card.color-red { border-left: 4px solid var(--error-color); }
.note-card.color-purple { border-left: 4px solid #8b5cf6; }

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.note-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
}

.note-pin {
    color: var(--warning-color);
    cursor: pointer;
}

.note-content {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-light);
}

.note-actions {
    display: flex;
    gap: 0.25rem;
}

/* ==================== TASK VIEW ==================== */
.task-view-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.task-header-card {
    background: linear-gradient(135deg, #4f6ef7 0%, #7c5cfc 100%);
    color: white;
    border: none;
}

.task-header-card .card-header {
    border: none;
    padding-bottom: 0;
}

.task-header-card h2 {
    color: white;
    margin: 0;
    font-size: 1.5rem;
}

.task-header-card .task-badges {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8125rem;
    opacity: 0.85;
    font-weight: 500;
}

.info-value {
    font-size: 0.9375rem;
}

.info-value a {
    color: white;
    text-decoration: underline;
}

.info-highlight {
    font-size: 1.375rem;
    font-weight: 700;
}

/* Time Tracking Display */
.time-tracking-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.time-stat {
    text-align: center;
    padding: 1rem;
    background: var(--border-light);
    border-radius: var(--border-radius-sm);
}

.time-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.time-stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.time-stat.over-budget .time-stat-value {
    color: var(--error-color);
}

.time-stat.under-budget .time-stat-value {
    color: var(--success-color);
}

/* Action Cards Row */
.action-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.action-card {
    display: flex;
    flex-direction: column;
}

.action-card h4 {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
}

/* Hours Summary */
.hours-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hours-summary-item {
    background: var(--border-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    text-align: center;
}

.hours-user-name {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.hours-user-role {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.hours-total {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.hours-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Files Grid */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--border-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
}

.file-item:hover {
    border-color: var(--primary-color);
}

.file-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-actions {
    display: flex;
    gap: 0.375rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

/* Hours Table Rows */
.hours-user-header {
    background: var(--border-light) !important;
}

.hours-total-row {
    background: var(--primary-light);
    font-weight: 600;
}

.hours-total-row td {
    padding: 0.75rem 1rem;
}

/* ==================== AUTH PAGES ==================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #4f6ef7 0%, #7c5cfc 100%);
    padding: 1rem;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-card h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 500;
}

.auth-form {
    margin-top: 1.5rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ==================== SIGNATURE PAD ==================== */
.signature-container {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    position: relative;
    touch-action: none;
}

.signature-pad {
    width: 100%;
    height: 250px;
    cursor: crosshair;
}

.signature-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ==================== DASHBOARD WIDGETS ==================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.widget {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 1rem;
    font-weight: 600;
}

.widget-full { grid-column: span 12; }
.widget-half { grid-column: span 6; }
.widget-third { grid-column: span 4; }
.widget-quarter { grid-column: span 3; }

/* Task List Widget */
.task-list-widget {
    max-height: 400px;
    overflow-y: auto;
}

.task-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    transition: all var(--transition);
}

.task-list-item:last-child {
    border-bottom: none;
}

.task-list-item:hover {
    background: var(--border-light);
    margin: 0 -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.task-priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.task-priority-dot.low { background: var(--secondary-color); }
.task-priority-dot.medium { background: var(--primary-color); }
.task-priority-dot.high { background: var(--warning-color); }
.task-priority-dot.urgent { background: var(--error-color); }

.task-list-content {
    flex: 1;
    min-width: 0;
}

.task-list-title {
    font-weight: 500;
    font-size: 0.9375rem;
    margin-bottom: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-list-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .widget-half,
    .widget-third,
    .widget-quarter {
        grid-column: span 6;
    }

    .content-body {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .content-header {
        padding: 0.5rem 1rem;
        padding-left: 3.5rem;
    }

    .content-header h2 {
        font-size: 0.9rem;
    }

    .content-body {
        padding: 1rem;
        padding-bottom: 5.5rem; /* clearance for bottom nav */
    }

    .card {
        padding: 1rem;
        border-radius: var(--border-radius-sm);
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header .action-buttons {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-header .action-buttons .btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.6rem;
    }

    .stat-value {
        font-size: 1.125rem;
    }

    .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .form-row {
        flex-direction: column;
    }

    table {
        font-size: 0.875rem;
    }

    table th,
    table td {
        padding: 0.625rem 0.75rem;
    }

    .task-info-grid {
        grid-template-columns: 1fr;
    }

    .action-cards-row {
        grid-template-columns: 1fr;
    }

    .hours-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .files-grid {
        grid-template-columns: 1fr;
    }

    .widget-full,
    .widget-half,
    .widget-third,
    .widget-quarter {
        grid-column: 1 / -1;
    }

    .dashboard-grid {
        gap: 1rem;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        margin: 0 -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
        scrollbar-width: none;
    }

    .quick-actions::-webkit-scrollbar {
        display: none;
    }

    .quick-action-btn {
        flex-shrink: 0;
        min-width: 72px;
        padding: 0.625rem 0.75rem;
    }

    /* Mobile follow-up list: card layout instead of table */
    .followup-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .followup-mobile-card {
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-sm);
        padding: 1rem;
        text-decoration: none;
        color: var(--text-color);
        display: block;
        transition: box-shadow 0.15s ease;
    }

    .followup-mobile-card:active {
        box-shadow: var(--shadow-md);
    }

    .followup-mobile-card.card-overdue {
        border-left: 3px solid #dc2626;
        background: #fef2f2;
    }

    .followup-mobile-card.card-completed {
        opacity: 0.65;
    }

    .followup-mobile-card-header {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .followup-mobile-card-icon {
        font-size: 1.25rem;
        flex-shrink: 0;
        width: 2rem;
        height: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--border-light);
        border-radius: var(--border-radius-sm);
    }

    .followup-mobile-card-title {
        flex: 1;
        min-width: 0;
    }

    .followup-mobile-card-subject {
        font-weight: 600;
        font-size: 0.9375rem;
        margin-bottom: 0.125rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .followup-mobile-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.375rem;
        align-items: center;
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    .followup-mobile-card-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
    }

    .followup-mobile-card-date {
        font-size: 0.8125rem;
        color: var(--text-muted);
    }

    .followup-mobile-card-date.overdue {
        color: #dc2626;
        font-weight: 600;
    }

    .followup-mobile-card-actions {
        display: flex;
        gap: 0.5rem;
    }

    /* Hide desktop table, show mobile cards on small screens */
    .desktop-only-table {
        display: none;
    }

    .mobile-only-cards {
        display: block;
    }

    /* Filter toggle for mobile */
    .filter-toggle-btn {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.625rem 1rem;
        background: var(--border-light);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-sm);
        color: var(--text-color);
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        width: 100%;
        margin-bottom: 0.75rem;
    }

    .filter-toggle-btn .filter-arrow {
        margin-left: auto;
        transition: transform 0.2s;
    }

    .filter-toggle-btn.active .filter-arrow {
        transform: rotate(180deg);
    }

    .mobile-filter-content {
        display: none;
    }

    .mobile-filter-content.show {
        display: block;
    }

    /* Better linked entities on mobile */
    .linked-entities {
        flex-direction: column;
    }

    .linked-entity {
        width: 100%;
    }

    /* Better followup detail grid on mobile */
    .followup-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Prevent iOS auto-zoom on input focus */
    .form-control,
    select.form-control,
    textarea.form-control,
    input[type="text"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="email"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px;
    }

    /* Modal full-width on mobile */
    .modal-content {
        max-width: 100%;
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }

    /* Better empty state on mobile */
    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state-icon {
        font-size: 2.5rem;
    }
}

/* Small mobile additional refinements */

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .hours-summary-grid {
        grid-template-columns: 1fr;
    }

    .time-tracking-card {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .content-header {
        padding-left: 3rem;
    }

    .content-header h2 {
        font-size: 0.875rem;
    }

    .card-header .action-buttons .btn {
        font-size: 0.8125rem;
    }
}

/* ==================== UTILITIES ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-error { color: var(--error-color); }
.text-warning { color: var(--warning-color); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.rounded { border-radius: var(--border-radius); }
.rounded-sm { border-radius: var(--border-radius-sm); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Animation utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-slow);
}

.animate-slide-up {
    animation: slideUp var(--transition-slow);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== BOTTOM NAVIGATION BAR ==================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    z-index: 1001;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 56px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex: 1;
    padding: 0.375rem 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 500;
    transition: color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    border: none;
    background: none;
}

.bottom-nav-item .bottom-nav-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item:hover {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }

    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ==================== MOBILE DASHBOARD CARDS ==================== */
.mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.mobile-card-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    color: var(--text-color);
    transition: box-shadow 0.15s ease;
}

.mobile-card-item:active {
    box-shadow: var(--shadow-md);
}

.mobile-card-item.card-overdue {
    border-left: 3px solid #dc2626;
    background: #fef2f2;
}

.mobile-card-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--border-light);
    border-radius: var(--border-radius-sm);
}

.mobile-card-body {
    flex: 1;
    min-width: 0;
}

.mobile-card-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mobile-card-amount {
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    text-align: right;
}

/* Print Styles */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .bottom-nav,
    .header-actions,
    .quick-actions,
    .btn {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===========================
   Follow-up Styles
   =========================== */

/* Follow-up list table overdue row */
.followup-row-overdue {
    border-left: 3px solid #dc2626;
    background: #fef2f2;
}

/* Follow-up type icon in table */
.followup-type-icon {
    font-size: 1.25rem;
    display: inline-block;
    width: 1.5rem;
    text-align: center;
}

/* Follow-up entity tags (linked entities in list) */
.followup-entities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.followup-entity-tag {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    background: var(--border-light);
    border-radius: 999px;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
}

.followup-entity-tag:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Dashboard follow-up widget */
.followup-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.followup-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text-color);
    transition: background 0.15s;
}

.followup-list-item:last-child {
    border-bottom: none;
}

.followup-list-item:hover {
    background: var(--border-light);
    margin: 0 -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    border-radius: var(--border-radius-sm);
}

.followup-list-item .followup-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
}

.followup-list-item .followup-info {
    flex: 1;
    min-width: 0;
}

.followup-list-item .followup-subject {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.followup-list-item .followup-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.125rem;
}

.followup-list-item .followup-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    text-align: right;
}

.followup-list-item .followup-date.overdue {
    color: #dc2626;
    font-weight: 600;
}

/* Entity view follow-up widget */
.followup-widget-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border-light);
}

.followup-widget-item:last-child {
    border-bottom: none;
}

.followup-widget-item .widget-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.followup-widget-item .widget-content {
    flex: 1;
    min-width: 0;
}

.followup-widget-item .widget-subject {
    font-size: 0.875rem;
    font-weight: 500;
}

.followup-widget-item .widget-subject a {
    color: var(--text-color);
    text-decoration: none;
}

.followup-widget-item .widget-subject a:hover {
    color: var(--primary-color);
}

.followup-widget-item .widget-details {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.125rem;
}

.followup-widget-item .widget-actions {
    flex-shrink: 0;
}

.followup-widget-overdue {
    border-left: 3px solid #dc2626;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

/* Completed follow-ups toggle */
.followup-completed-toggle {
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.followup-completed-toggle:hover {
    color: var(--text-color);
}

.followup-completed-section {
    display: none;
}

.followup-completed-section.show {
    display: block;
}

.followup-completed-section .followup-widget-item {
    opacity: 0.6;
}

/* Filter bar for follow-up list */
.followup-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}

.followup-filters .form-group {
    margin-bottom: 0;
    min-width: 140px;
}

.followup-filters .form-group label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.followup-filters .form-group select,
.followup-filters .form-group input {
    font-size: 0.8125rem;
    padding: 0.375rem 0.5rem;
}

@media (max-width: 768px) {
    .followup-filters {
        flex-direction: column;
    }
    .followup-filters .form-group {
        width: 100%;
    }
}

/* ===========================
   Report / Statistics Styles
   =========================== */

/* Tab Navigation */
.report-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.report-tabs::-webkit-scrollbar {
    display: none;
}

.report-tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.report-tab:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.report-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Report Progress Bars (inline in tables) */
.report-progress-bar {
    background: var(--border-color);
    border-radius: 9999px;
    height: 8px;
    overflow: hidden;
    min-width: 60px;
}

.report-progress-fill {
    height: 100%;
    border-radius: 9999px;
    background: var(--primary-color);
    transition: width var(--transition-slow);
}

.report-progress-fill.over-budget {
    background: var(--error-color);
}

@media (max-width: 768px) {
    .report-tabs {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .report-tab {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

/* Desktop/mobile visibility helpers */
.mobile-only-cards {
    display: none;
}

.desktop-only-table {
    display: block;
}

.filter-toggle-btn {
    display: none;
}

/* Privacy Mode */
.privacy-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.privacy-toggle:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

body.privacy-mode .privacy-value {
    filter: blur(8px);
    user-select: none;
    transition: filter 0.2s ease;
}

body.privacy-mode .privacy-value:hover {
    filter: blur(8px);
}

/* ==================== PERSONAL FINANCE MOBILE RESPONSIVE ==================== */

/* Personal dashboard widget grid (uses .dashboard-widget instead of .widget) */
.dashboard-widget {
    grid-column: 1 / -1;
}

@media (min-width: 769px) {
    .dashboard-widget {
        grid-column: span 6;
    }
    .dashboard-widget.widget-full {
        grid-column: 1 / -1;
    }
}

/* Tab navigation horizontal scroll on mobile */
@media (max-width: 768px) {
    .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        scrollbar-width: none;
    }
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
}

/* Filter bars: stack vertically on mobile */
@media (max-width: 768px) {
    .filter-bar .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar .filter-form .form-control {
        max-width: 100%;
        width: 100%;
    }
    .filter-bar .filter-form .btn {
        width: 100%;
        justify-content: center;
    }

    /* Card header: stack title and actions vertically */
    .card-header .card-actions {
        width: 100%;
    }
    .card-header .card-actions .loan-filters,
    .card-header .card-actions form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .card-header .card-actions .loan-filters select,
    .card-header .card-actions .loan-filters input {
        width: 100% !important;
    }

    /* Quick actions: wrap to 2 columns on mobile */
    .dashboard-grid .quick-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        overflow-x: visible;
        flex-wrap: wrap;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }
    .dashboard-grid .quick-action-btn {
        min-width: 0;
        text-align: center;
    }

    /* Buttons: ensure minimum 44px touch target */
    .btn {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 38px;
    }

    /* Font sizes: slightly smaller stat values */
    .stat-value {
        font-size: 1rem;
    }

    /* Summary rows (properties, loans, transactions) stack on mobile */
    .summary-row {
        gap: 0.5rem;
    }
    .summary-card {
        min-width: 0;
        padding: 0.75rem 0.5rem;
    }
    .summary-value {
        font-size: 1rem;
    }

    /* Loan financials stack */
    .loan-financials {
        flex-direction: column;
    }
    .fin-item {
        min-width: 0;
    }

    /* Inline forms in amortization table */
    .inline-form .btn {
        width: 100%;
        font-size: 0.8125rem;
    }
}

/* Small phone additional refinements for personal finance */
@media (max-width: 480px) {
    .stat-value {
        font-size: 1rem;
    }

    .stat-icon {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    .stat-card {
        padding: 0.5rem;
        gap: 0.4rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    /* Dashboard quick actions: single column on very small phones */
    .dashboard-grid .quick-actions {
        grid-template-columns: 1fr;
    }

    /* Reduce card padding further */
    .card {
        padding: 0.75rem;
    }

    .card-header {
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
    }

    /* Property cards stats */
    .property-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ==================== SEARCHABLE SELECT ==================== */
.searchable-select-wrapper {
    position: relative;
}

.searchable-select-trigger {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.9375rem;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: all var(--transition);
    line-height: 1.5;
}

.searchable-select-trigger:hover {
    border-color: #c5c2bb;
}

.searchable-select-trigger.open {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.searchable-select-trigger .trigger-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.searchable-select-trigger .trigger-text.placeholder {
    color: var(--text-light);
}

.searchable-select-trigger .trigger-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: var(--text-light);
    transition: transform var(--transition-fast);
}

.searchable-select-trigger.open .trigger-arrow {
    transform: rotate(180deg);
}

.searchable-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 280px;
    overflow: hidden;
    flex-direction: column;
}

.searchable-select-dropdown.open {
    display: flex;
    animation: slideUp 0.15s ease;
}

.searchable-select-search {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.searchable-select-search input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.625rem;
    font-size: 0.875rem;
    outline: none;
    background: var(--border-light);
    color: var(--text-color);
}

.searchable-select-search input:focus {
    border-color: var(--primary-color);
    background: var(--card-bg);
}

.searchable-select-options {
    overflow-y: auto;
    flex: 1;
}

.searchable-select-option {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9375rem;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.searchable-select-option:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.searchable-select-option.selected {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 500;
}

.searchable-select-option.hidden {
    display: none;
}

.searchable-select-empty {
    padding: 1rem 0.75rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ==================== PAYMENT SUMMARY CARD ==================== */
.payment-summary {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f7f4 0%, #eef2ff 100%);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.payment-summary-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.payment-summary-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-top: 0.25rem;
}

.payment-summary-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-color);
    margin-top: 0.5rem;
    letter-spacing: -0.02em;
}

/* ==================== INSTANT SEARCH ==================== */
.instant-search-box {
    margin-bottom: 0.75rem;
}

.instant-search-box .instant-search {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    background-color: var(--card-bg);
    color: var(--text-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    transition: all var(--transition);
}

.instant-search-box .instant-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.instant-search-box .instant-search::placeholder {
    color: var(--text-light);
}

.instant-search-no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Inside card - no extra margin needed */
.card > .instant-search-box {
    margin-bottom: 0;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .instant-search-box .instant-search {
        font-size: 16px;
        padding: 0.625rem 0.75rem 0.625rem 2.25rem;
    }
}

/* ========== WORK PLANNER ========== */

/* Weekday Tabs */
.plan-weekday-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.plan-week-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 44px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.plan-week-arrow:hover { color: var(--primary-color); }

.plan-weekday {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0.3rem 0.2rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-light);
    transition: all 0.12s;
    min-width: 36px;
}

.plan-weekday:hover { background: var(--bg-secondary); }

.plan-weekday.active {
    background: var(--primary-color);
    color: #fff;
}

.plan-weekday.today:not(.active) {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.plan-wd-name {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.plan-wd-stats {
    font-size: 0.6rem;
    font-weight: 500;
    opacity: 0.7;
}
.plan-wd-stats.all-done {
    opacity: 1;
    color: #16a34a;
}
.plan-weekday.active .plan-wd-stats.all-done {
    color: #bbf7d0;
}

/* Date Navigation */
.plan-date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.plan-nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.1rem;
    transition: background 0.15s;
}

.plan-nav-arrow:hover {
    background: var(--primary-color);
    color: #fff;
}

.plan-date-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.plan-date-input {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
}

.plan-date-label {
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

.plan-date-label:hover {
    color: var(--primary-color);
}

.plan-today-btn {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

/* Stats Bar */
.plan-stats {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

.plan-stat.success { color: var(--success-color); font-weight: 600; }
.plan-stat.warning { color: var(--warning-color); font-weight: 600; }

/* Plan Items */
.plan-items {
    margin-bottom: 1rem;
}

.plan-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.plan-item:hover {
    background: var(--bg-secondary);
}

.plan-item-done {
    opacity: 0.6;
}

.plan-item-done .plan-item-title {
    text-decoration: line-through;
}

.plan-item-active {
    border-left: 3px solid var(--primary-color);
    padding-left: calc(0.5rem - 3px);
}

.plan-drag-handle {
    cursor: grab;
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 0.25rem 0.1rem;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
    opacity: 0.5;
}
.plan-drag-handle:active {
    cursor: grabbing;
}
.plan-item:hover .plan-drag-handle {
    opacity: 1;
}
.sortable-ghost {
    opacity: 0.4;
    background: var(--primary-color-light, #e0edff);
}
.sortable-chosen {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    background: var(--bg-primary);
}

.plan-item-left {
    flex-shrink: 0;
    padding-top: 2px;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.plan-status-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}

.plan-item-content {
    flex: 1;
    min-width: 0;
}

.plan-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
}

.plan-item-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.plan-item-title a:hover {
    color: var(--primary-color);
}

.plan-item-meta {
    font-size: 0.7rem;
    color: var(--text-light);
    display: flex;
    gap: 0.5rem;
    margin-top: 0.15rem;
}

.plan-item-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.plan-hours-input {
    width: 48px;
    padding: 0.2rem 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    text-align: center;
    background: var(--card-bg);
    color: var(--text-primary);
}

.plan-hours-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.plan-done-time {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
}

.plan-logged-time {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
}

.plan-remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    line-height: 1;
}

.plan-remove-btn:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.inline-form { display: inline; }

/* Add Section */
.plan-add-section {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 0.75rem;
    margin-top: 0.5rem;
}

.plan-add-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.plan-add-tab {
    background: none;
    border: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.plan-add-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.plan-add-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.plan-add-row .form-control {
    flex: 1;
    font-size: 0.85rem;
}

.plan-add-row .btn {
    flex-shrink: 0;
}

/* Weekly View */
.plan-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.plan-day-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.plan-day-today {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.plan-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
}

.plan-day-name {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
}

.plan-day-num {
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

.plan-day-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-light);
    font-weight: 600;
}

.plan-day-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.plan-day-items {
    flex: 1;
    overflow: hidden;
}

.plan-day-empty {
    font-size: 0.7rem;
    color: var(--text-light);
    text-align: center;
    padding: 0.5rem 0;
}

.plan-day-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    padding: 0.15rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-day-item.done {
    opacity: 0.5;
    text-decoration: line-through;
}

.plan-day-item.active {
    color: var(--primary-color);
}

.plan-day-item-icon {
    font-size: 0.6rem;
    flex-shrink: 0;
}

.plan-day-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-day-link {
    display: block;
    text-align: center;
    font-size: 0.7rem;
    color: var(--primary-color);
    text-decoration: none;
    padding-top: 0.3rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.plan-day-link:hover {
    text-decoration: underline;
}

/* Quick Add */
.plan-quick-add-top {
    margin-bottom: 0.5rem;
}
.plan-quick-add-top .plan-quick-add {
    margin-bottom: 0;
}
.plan-quick-add {
    margin-bottom: 0.75rem;
}

/* Task Picker (tap to add) */
.plan-pick-section {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}

.plan-pick-search {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.plan-pick-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.plan-pick-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.4rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    font-family: inherit;
}

.plan-pick-item:hover {
    background: rgba(59, 130, 246, 0.08);
}

.plan-pick-item:active {
    background: rgba(59, 130, 246, 0.15);
}

.plan-pick-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
    line-height: 1;
}

.plan-pick-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.plan-pick-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-pick-meta {
    font-size: 0.68rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Type tags */
.plan-type-tag {
    display: inline-block;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

.plan-type-tag.request {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
}

.plan-type-tag.task {
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary-color);
}

/* Assignee badges */
.plan-assignees { display: inline-flex; gap: 0.15rem; margin-left: 0.25rem; }
.plan-assignee-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.45rem; height: 1.25rem; border-radius: 0.625rem;
    padding: 0 0.2rem; background: var(--primary-color); color: #fff;
    font-size: 0.55rem; font-weight: 700; flex-shrink: 0;
}
.plan-assignee-badge:nth-child(2) { background: #8b5cf6; }
.plan-assignee-badge:nth-child(3) { background: #06b6d4; }
.plan-assignee-badge:nth-child(4) { background: #f59e0b; }

/* Bottom sheet (shared between daily & overview) */
.kb-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.35); z-index: 999;
}
.kb-overlay.open { display: block; }
.kb-sheet {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--card-bg); border-radius: 14px 14px 0 0;
    z-index: 1000; padding: 0.5rem 1rem 1.5rem;
    max-height: 70vh; overflow-y: auto;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}
.kb-sheet.open { display: block; }
.kb-sheet-handle {
    width: 36px; height: 4px; background: var(--border-color);
    border-radius: 2px; margin: 0 auto 0.75rem; cursor: pointer;
}
.kb-sheet-title {
    font-size: 0.8125rem; font-weight: 600; margin-bottom: 0.75rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 0 0.25rem;
}
.kb-sheet-actions { display: flex; flex-direction: column; gap: 0.25rem; }
.kb-sheet-btn {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.625rem 0.75rem; border: none; background: none;
    cursor: pointer; font-size: 0.8125rem; color: var(--text-color);
    border-radius: 8px; width: 100%; text-align: left;
}
.kb-sheet-btn:hover, .kb-sheet-btn:active { background: var(--bg-color); }
.kb-sheet-btn-icon { width: 1.25rem; text-align: center; flex-shrink: 0; }
.kb-sheet-btn.danger { color: #dc2626; }
.kb-sheet-rename { display: flex; gap: 0.375rem; align-items: center; padding: 0.25rem 0; }
.kb-sheet-divider { height: 1px; background: var(--border-color); margin: 0.375rem 0; }
@media (min-width: 768px) {
    .kb-sheet {
        left: 50%; right: auto; bottom: auto; top: 50%;
        transform: translate(-50%, -50%); border-radius: 14px;
        max-width: 380px; width: 90%; max-height: 80vh;
    }
}

/* Three-dot menu button on plan items */
.plan-item-menu-btn {
    border: none; background: none; cursor: pointer;
    font-size: 1.1rem; line-height: 1; color: var(--text-muted);
    padding: 0.125rem 0.25rem; flex-shrink: 0; border-radius: 3px;
}
.plan-item-menu-btn:hover { background: var(--border-color); color: var(--text-color); }

/* Source buttons (Tasks / Tickets) */
.plan-source-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.plan-source-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s;
}

.plan-source-btn:hover { border-color: var(--primary-color); }

.plan-source-btn.open {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.06);
    color: var(--primary-color);
}

.plan-source-btn.ticket.open {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.06);
    color: var(--warning-color);
}

.plan-source-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    border-radius: 10px;
    background: var(--bg-secondary);
    font-size: 0.7rem;
    font-weight: 700;
}

.plan-source-btn.open .plan-source-count {
    background: rgba(59, 130, 246, 0.15);
}

.plan-source-btn.ticket.open .plan-source-count {
    background: rgba(245, 158, 11, 0.15);
}

/* Source panel */
.plan-source-panel {
    margin-top: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
}

/* Timer */
.plan-timer-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}

.plan-timer-btn.play {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success-color);
}

.plan-timer-btn.play:hover {
    background: var(--success-color);
    color: #fff;
}

.plan-timer-btn.stop {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger-color);
    font-size: 0.6rem;
}

.plan-timer-btn.stop:hover {
    background: var(--danger-color);
    color: #fff;
}

.plan-timer {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.plan-timer.running .plan-timer-display {
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--danger-color);
    min-width: 40px;
    text-align: right;
    animation: plan-timer-pulse 2s ease-in-out infinite;
}

@keyframes plan-timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Item actions dropdown */
.plan-item-actions {
    position: relative;
}

.plan-actions-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.1rem 0.3rem;
    color: var(--text-light);
    border-radius: 4px;
    line-height: 1;
}

.plan-actions-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.plan-actions-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 50;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 160px;
    padding: 0.25rem 0;
}

.plan-actions-menu.open { display: block; }

.plan-action-link {
    display: block;
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 0.78rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.plan-action-link:hover { background: var(--bg-secondary); }
.plan-action-link.danger { color: var(--danger-color); }
.plan-action-link.danger:hover { background: rgba(239, 68, 68, 0.08); }

/* Modal */
.plan-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.plan-modal {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.plan-modal-header {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

/* Urgent/high pick items highlighted */
.plan-pick-urgent {
    background: rgba(239, 68, 68, 0.04);
    border-left: 3px solid var(--danger-color);
    padding-left: calc(0.4rem - 3px);
}

.plan-pick-urgent:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Report Filters */
.plan-report-filters {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

/* Bulk select checkbox */
.plan-bulk-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
    flex-shrink: 0;
    margin: 0;
}

/* Bulk action bar */
.plan-bulk-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.375rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    z-index: 1000;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.bulk-count {
    font-weight: 700;
    font-size: 0.6875rem;
    flex-shrink: 0;
    background: var(--primary-color);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bulk-day-btns {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
}
.bulk-day-btns::-webkit-scrollbar { display: none; }
.bulk-day-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.bulk-day-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.bulk-icon-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.125rem 0.25rem;
    color: var(--text-muted);
    flex-shrink: 0;
    border-radius: 4px;
    line-height: 1;
}
.bulk-icon-btn:hover {
    background: var(--bg-color);
    color: var(--text-color);
}
.bulk-close-btn {
    font-size: 1.125rem;
    font-weight: 700;
}

/* Assign to user modal */
.plan-assign-users {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.plan-assign-user-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
    transition: background 0.15s;
}
.plan-assign-user-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
.plan-assign-user-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    user-select: none;
    -webkit-user-select: none;
}
.plan-assign-user-check:hover {
    border-color: var(--primary-color);
}
.plan-assign-user-check:has(input:checked) {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.plan-assign-user-check input {
    width: auto;
    accent-color: #fff;
}

/* Mobile: bulk bar sits above bottom nav */
@media (max-width: 768px) {
    .plan-bulk-bar {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }
}

/* Mobile: Weekly grid stacks vertically */
@media (max-width: 768px) {
    .plan-week-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .plan-day-card {
        min-height: auto;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .plan-day-header {
        flex-direction: column;
        align-items: flex-start;
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
        min-width: 50px;
    }

    .plan-day-items {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        flex: 1;
    }

    .plan-day-link {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }

    .plan-add-row {
        flex-wrap: wrap;
    }

    .plan-add-row .form-control {
        min-width: 0;
    }

    .plan-date-label {
        font-size: 0.9rem;
    }

    /* Date picker: make label clickable to open native picker */
    .plan-date-input {
        width: auto;
        height: auto;
        opacity: 1;
        position: static;
        max-width: 130px;
        font-size: 0.85rem;
        padding: 0.2rem 0.3rem;
        border: 1px solid var(--border-color);
        border-radius: 4px;
    }

    .plan-date-label {
        display: none;
    }
}

/* ============================================
   Past Pending (Overdue) Widget
   ============================================ */
.past-pending-widget {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.past-pending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    user-select: none;
}
.past-pending-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #92400e;
}
.past-pending-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f59e0b;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    border-radius: 10px;
    padding: 0 0.3rem;
    margin-left: 0.375rem;
}
.past-pending-toggle {
    font-size: 0.625rem;
    color: #92400e;
    transition: transform 0.2s;
}
.past-pending-toggle.open {
    transform: rotate(180deg);
}
.past-pending-body {
    border-top: 1px solid #fcd34d;
    background: #fffbeb;
}
.pp-date-group {
    padding: 0;
}
.pp-date-group + .pp-date-group {
    border-top: 1px solid #fde68a;
}
.pp-date-label {
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #92400e;
    text-transform: uppercase;
    background: rgba(245, 158, 11, 0.08);
}
.pp-ago {
    font-weight: 400;
    opacity: 0.7;
    text-transform: none;
}
.pp-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
}
.pp-item + .pp-item {
    border-top: 1px solid #fef3c7;
}
.pp-complete-btn {
    font-size: 0.875rem;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #d97706;
    border-radius: 50%;
    background: transparent;
    color: #d97706;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
    line-height: 1;
}
.pp-complete-btn:hover {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}
.pp-complete-btn:active {
    transform: scale(0.9);
}
.pp-item-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
    width: 1rem;
    text-align: center;
    color: #d97706;
}
.pp-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.pp-item-title {
    font-size: 0.8125rem;
    color: #1a1a2e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pp-item-link {
    text-decoration: none;
    color: #92400e;
}
.pp-item-link:hover {
    text-decoration: underline;
    color: #78350f;
}
.pp-item-meta {
    font-size: 0.6875rem;
    color: #92400e;
    opacity: 0.7;
}
.pp-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}
.pp-btn {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    background: #fff;
    color: #92400e;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.pp-btn:hover {
    background: #fef3c7;
}
.pp-btn.pp-move-today {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}
.pp-btn.pp-move-today:hover {
    background: #d97706;
}
.pp-bulk-actions {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #fde68a;
    text-align: center;
}

/* Past pending menus */
.pp-menu-overlay,
.pp-date-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.pp-menu {
    background: var(--card-bg);
    border-radius: 12px 12px 0 0;
    padding: 1rem;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}
.pp-menu-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    text-align: center;
    color: var(--text-muted);
}
.pp-menu-btn {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: none;
    background: none;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-color);
}
.pp-menu-btn:hover {
    background: var(--bg-color);
}
.pp-menu-btn.pp-menu-danger {
    color: var(--error-color);
}
.pp-menu-btn.pp-menu-cancel {
    margin-top: 0.5rem;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    padding-top: 0.75rem;
}

@media (min-width: 500px) {
    .pp-menu-overlay,
    .pp-date-picker-overlay {
        align-items: center;
    }
    .pp-menu {
        border-radius: 12px;
    }
}

/* ===== Notification Bell ===== */
.notif-bell-wrap {
    position: relative;
}
.notif-bell-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    position: relative;
    padding: 4px 8px;
    line-height: 1;
    color: var(--text-color);
}
.notif-badge {
    position: absolute;
    top: -2px;
    right: 0;
    background: var(--error-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    text-align: center;
    border-radius: 999px;
    padding: 0 4px;
    animation: notifPulse 2s ease-in-out infinite;
}
@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
.notif-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 340px;
    max-height: 60vh;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.notif-dd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}
.notif-dd-header button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}
.notif-dd-header button:hover {
    text-decoration: underline;
}
.notif-list {
    overflow-y: auto;
    flex: 1;
    max-height: calc(60vh - 50px);
}
.notif-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}
.notif-item:hover {
    background: var(--primary-light);
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-item-content {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}
.notif-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2px;
}
.notif-item-msg {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 3px;
}
.notif-accept-btn {
    background: var(--success-light);
    color: var(--success-color);
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    transition: background 0.15s;
}
.notif-accept-btn:hover {
    background: var(--success-color);
    color: #fff;
}

@media (max-width: 768px) {
    .notif-dropdown {
        position: fixed;
        left: 8px;
        right: 8px;
        top: calc(var(--header-height) + 4px);
        width: auto;
    }
}
