/* Page Structure */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.page-subtitle {
    color: var(--text-gray);
    font-size: 1rem;
}

/* CRM page specific tweaks */
.crm-card .table-responsive {
    /* Let the page handle vertical scrolling; keep horizontal if needed */
    max-height: none;
    overflow-y: visible;
    overflow-x: auto;
}

/* Keep table header visible while scrolling (optional, improves UX) */
.crm-card .table-responsive table thead th {
    position: sticky;
    top: 0;
    background: var(--card-bg, #fff);
    z-index: 1;
}

/* Dashboard Specific */
.dashboard-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1.5rem;
    /* base row height used for vertical snapping; allow content to expand */
    grid-auto-rows: minmax(var(--row-unit, 12px), auto);
    position: relative;
}

.dashboard-grid > .card,
.dashboard-grid > .stats-grid {
    /* default to full width unless overridden inline */
    grid-column: span 12;
}

.dashboard-grid > .card {
    /* Allow dropdowns/overlays inside widgets to escape the card bounds */
    overflow: visible;
}

/* Size controls shown only in customize mode */
.resize-controls {
    display: none;
    gap: 6px;
    margin-left: 8px;
}
.resize-controls .resize-btn {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-dark);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}
.resize-controls .resize-btn.active {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
}
.page.customize-mode .resize-controls {
    display: inline-flex;
}

.quick-action-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 150px;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-action-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.quick-action-label {
    font-weight: 500;
    color: var(--text-dark);
}

/* Project Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.project-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.project-card-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.project-number {
    font-size: 0.75rem;
    color: var(--text-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.project-comment-pill {
    margin-left: 6px;
}

.project-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0.25rem 0 0.5rem;
    color: var(--text-dark);
}

.project-client {
    color: var(--text-gray);
    font-size: 0.875rem;
}

.project-card-body {
    padding: 1rem 1.5rem;
}

.project-progress {
    margin-bottom: 1rem;
}

.project-progress-label {
    display: flex;
    justify-content: between;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.project-progress-percent {
    font-weight: 600;
    color: var(--primary-cyan);
}

.project-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.project-stat {
    text-align: center;
}

.project-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.project-stat-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-card-footer {
    padding: 1rem 1.5rem;
    background: var(--primary-silver);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-team {
    display: flex;
    gap: 0.25rem;
}

.team-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-cyan);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.team-avatar:not(:first-child) {
    margin-left: -8px;
}

/* Utilization: ensure avatars never stretch in overview tables */
.user-pill .avatar img {
    width: 24px;
    height: 24px;
    max-width: 24px;
    max-height: 24px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
}

/* Utility: allow long names/descriptions to wrap cleanly */
.break-words {
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Offers Grid */
.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.offer-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.offer-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.offer-card-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.offer-number {
    font-size: 0.75rem;
    color: var(--text-gray);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.offer-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0.5rem 0;
    line-height: 1.4;
}

.offer-client {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

.offer-card-body {
    padding: 1rem 1.5rem;
}

.offer-amount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.offer-amount-label {
    font-size: 0.875rem;
    color: var(--text-gray);
}

.offer-amount-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-cyan);
}

.offer-validity {
    font-size: 0.875rem;
    color: var(--text-gray);
}

.offer-card-footer {
    padding: 1rem 1.5rem;
    background: var(--primary-silver);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.offer-card-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.offer-card:hover .offer-card-actions {
    opacity: 1;
}

/* Offer Detail Modal */
.offer-detail-section {
    margin-bottom: 2rem;
}

.offer-detail-section:last-child {
    margin-bottom: 0;
}

.offer-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

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

.offer-detail-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.offer-detail-item span {
    font-size: 1rem;
    color: var(--text-dark);
}

/* Time Entry Grid */
.time-entry-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    /* Ensure grid doesn't overflow small containers */
    overflow-x: auto;
}

/* Ensure day cards have a reasonable min width when horizontally scrollable */
.time-entry-grid > .day-card { min-width: 140px; }

/* Time Tracking badges: keep compact */
.time-tracking-page .badge {
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

/* Calendar */
.calendar-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
}

.calendar-weekday {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.25rem 0.5rem;
}

/* Make weekend headers visually distinct too */
.calendar-weekday.weekend {
    color: var(--text-dark);
    background: rgba(3, 105, 161, 0.06);
    border-radius: 6px;
}

.calendar-day {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    min-height: 100px;
    position: relative;
}

.calendar-day.weekend {
    /* Make weekends clearly visible with a gentle blue tint */
    background: linear-gradient(180deg, rgba(3, 105, 161, 0.06), rgba(3, 105, 161, 0.06));
}

.calendar-day.outside-month {
    background: #f9fafb;
    color: var(--text-gray);
}

.calendar-day.today {
    box-shadow: inset 0 0 0 2px var(--primary-cyan);
}

.calendar-day-header-row {
    display: contents;
}

.calendar-day-number {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-event {
    font-size: 0.75rem;
    line-height: 1.2;
    padding: 4px 6px;
    border-radius: 6px;
    background: var(--primary-silver);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event.more {
    background: transparent;
    border: none;
    color: var(--text-gray);
    padding: 0;
}

/* Optional: visually mark holidays similar to weekends */
.calendar-day.holiday {
    opacity: 0.7;
}

/* People–Year Calendar */
.calendar-people-year {
    position: relative;
    /* Keep header aligned with sticky user column */
    --year-sticky-width: 220px;
}
.calendar-year-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg, #fff);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    /* Reserve the name column width so day headers align with rows */
    padding-left: var(--year-sticky-width);
}
.calendar-year-header .year-header-inner {
    position: relative;
    display: flex;
}
.year-day-header {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 36px;
    color: var(--text-gray);
    border-right: 1px solid var(--border-color);
}
.year-day-header .wday { font-size: 10px; line-height: 1; }
.year-day-header .dnum { font-size: 11px; font-weight: 600; line-height: 1; }
.year-day-header.weekend { background: rgba(3, 105, 161, 0.08); }
.year-day-header.today { box-shadow: inset 0 -2px 0 var(--primary-cyan); font-weight: 600; color: var(--text-dark); }
.year-day-header.month-start { border-left: 2px solid var(--border-color); }
/* Stick month names inside the header so they are visible */
.calendar-year-header { min-height: 52px; padding-top: 16px; }
.calendar-year-header .month-label {
    position: absolute;
    top: 2px;
    transform: none;
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 600;
    pointer-events: none;
}

.calendar-year-viewport {
    position: relative;
    /* Enable both axes to allow horizontal movement and internal vertical virtualization */
    overflow-x: auto;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* Give the viewport its own vertical scroll so rows virtualize correctly */
    max-height: 60vh;
}
.calendar-year-grid {
    position: relative;
}
.year-row {
    position: absolute;
    left: 0; right: 0;
    border-bottom: 1px solid var(--border-color);
}
.year-row-sticky {
    position: sticky; /* keep names visible while horizontally scrolling */
    left: 0;
    top: auto;
    background: var(--bg, #fff);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 8px;
    z-index: 10; /* above cells */
    border-right: 1px solid var(--border-color);
    width: var(--year-sticky-width);
    min-width: var(--year-sticky-width);
}
.year-row-sticky .avatar {
    width: 18px; height: 18px; border-radius: 50%;
    background: #e6edf5; color: #234;
    font-size: 11px; display: inline-flex; align-items:center; justify-content:center; font-weight: 600;
}
.year-row-sticky .name { font-size: 12px; color: var(--text-dark); }
.year-row-cells { position: absolute; display: flex; gap: 0; height: 100%; top: 0; z-index: 1; }
.year-day-cell {
    position: absolute;
    top: 1px; bottom: 1px;
    border-right: 1px solid var(--border-color);
    background: #fff;
}
.year-day-cell.weekend { background: rgba(3, 105, 161, 0.06); }
.year-day-cell.today { box-shadow: inset 0 0 0 2px var(--primary-cyan); }
.year-day-cell.ok { background: linear-gradient(180deg, rgba(16,185,129,0.15), rgba(16,185,129,0.15)); }
.year-day-cell.under { background: linear-gradient(180deg, rgba(240,173,78,0.15), rgba(240,173,78,0.15)); }
.year-day-cell.none { background: #ffffff; }
.year-day-cell.absence { background: linear-gradient(180deg, rgba(240,173,78,0.12), rgba(240,173,78,0.12)); }
.year-day-cell.absence::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    border-left: 8px solid transparent;
    border-top: 8px solid var(--warning, #f0ad4e);
}

/* Pinned current-user row at top */
.year-row-pinned {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--bg, #fff);
    border-bottom: 1px solid var(--border-color);
}
.year-row-pinned .year-row-sticky {
    background: linear-gradient(90deg, rgba(0,178,204,0.12), rgba(255,255,255,0));
    border-right: 1px solid var(--border-color);
}
.year-row-pinned .year-row-sticky .name { font-weight: 600; }

/* Legend chips */
.legend-chip { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: middle; margin-right: 6px; border: 1px solid var(--border-color); }
.legend-chip.legend-ok { background: rgba(16,185,129,0.25); }
.legend-chip.legend-under { background: rgba(240,173,78,0.25); }
.legend-chip.legend-none { background: #ffffff; }
.legend-chip.legend-absence { background: linear-gradient(45deg, transparent 50%, var(--warning, #f0ad4e) 0); }
.legend-chip.legend-weekend { background: rgba(3, 105, 161, 0.06); }

/* Time Tracking Grid */
.day-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

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

.day-card.complete {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #fff 0%, #f0fff4 100%);
}

.day-card.incomplete {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, #fff 0%, #fffaf0 100%);
}

.day-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-gray);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-date {
    font-size: 0.875rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

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

.day-card.complete .hours-display {
    color: var(--success-color);
}

.day-card.incomplete .hours-display {
    color: var(--warning-color);
}

.hours-label {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.week-summary {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--primary-silver);
    border-radius: 8px;
}

/* Time Entry Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    /* Add a bit of right padding so rightmost actions aren't flush/cut off */
    padding-right: 16px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin: 0;
}

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

.table th {
    background: var(--primary-silver);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tr:hover {
    background: var(--hover-color);
}

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

/* Team page table: tighter density without hiding data */
.page.team-page .team-table {
    font-size: 0.8125rem;
    line-height: 1.3;
}

.page.team-page .team-table th,
.page.team-page .team-table td {
    padding: 0.5rem 0.5rem;
}

.page.team-page .team-table th {
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.page.team-page .team-table-container {
    margin-top: 0.25rem;
    padding-right: 8px;
}

/* Time Entry Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1600;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--hover-color);
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Larger modal variant for complex forms (e.g., reimbursements) */
.modal .modal-content.modal-lg {
    max-width: 920px;
    width: 95%;
}

/* Allow more vertical space for larger modals; ensure footer stays visible */
.modal .modal-content.modal-lg .modal-body {
    max-height: calc(90vh - 140px);
}

/* Utilization → Planning: fullscreen card */
.card.card--fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    background: var(--bg, #fff);
    z-index: 1200; /* above header and standard UI, below bug-report overlay */
    display: flex;
    flex-direction: column;
}
.card.card--fullscreen .card-body {
    flex: 1;
    min-height: 0;
    overflow: hidden; /* inner grid will scroll */
}
.card.card--fullscreen #planGridContainer {
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: auto;
}
.card.card--fullscreen #planGridContainer > div {
    min-height: 100%;
    max-height: none !important;
}

.plan-grid-wrapper {
    position: relative;
}

.card.card--fullscreen .plan-grid-wrapper {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.plan-grid-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 50;
    pointer-events: none;
    color: var(--text, #333);
    font-weight: 500;
    font-size: 0.95rem;
}

.plan-grid-wrapper.is-loading .plan-grid-loading {
    pointer-events: all;
}

.plan-grid-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary, #1f8ceb);
    animation: plan-grid-spin 0.8s linear infinite;
}

@keyframes plan-grid-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.1);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

/* Progress Bar */
.progress {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-cyan) 0%, var(--secondary-color) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* CRM Specific */
/* Ensure both the wrapper and inner container lay out chips horizontally */
.client-filters,
#clientTypeFilters {
    display: flex;
    gap: 0.75rem;
    /* Tighter spacing so filters sit closer to controls */
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.filter-chip:hover, .filter-chip.active {
    background: var(--primary-cyan);
    border-color: var(--primary-cyan);
    color: white;
}

/* CRM toolbar layout in card header */
.crm-card .card-header {
    /* Allow header content to wrap neatly and align to top */
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.crm-card .crm-search {
    /* Let search/filters occupy the left side and wrap as needed */
    flex: 1 1 600px;
    row-gap: 0.5rem;
}

.crm-card #statusFilter {
    margin-top: 2px; /* subtle visual alignment */
}

.crm-card .crm-right {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

.crm-card .crm-actions,
.crm-card .crm-ctas {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* CRM toolbar responsive tweaks */
@media (max-width: 1024px) {
  .crm-card .crm-search { flex: 1 1 100%; }
  .crm-card .crm-right { margin-left: 0; }
}

@media (max-width: 768px) {
  .crm-card .card-header { flex-direction: column; align-items: stretch; }
  .crm-card .crm-search { width: 100%; flex: 1 1 auto; }
  .crm-card .crm-right { width: 100%; align-items: stretch; }
  .crm-card .crm-actions, .crm-card .crm-ctas { justify-content: flex-start; flex-wrap: wrap; }
  /* Make chips horizontally scrollable to save vertical space */
  .client-filters,
  #clientTypeFilters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0.5rem; }
  .filter-chip { white-space: nowrap; }
}

.crm-client-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
    gap: 1.5rem;
    align-items: flex-start;
    width: 100%;
}

@media (max-width: 1200px) {
  .crm-client-detail-layout {
      grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
      gap: 1.25rem;
  }
}

@media (max-width: 920px) {
  .crm-client-detail-layout {
      grid-template-columns: minmax(0, 1fr);
  }
}

.client-activity-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.client-activity-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.client-activity-type {
    width: 180px;
    max-width: 100%;
}

.client-activity-controls .btn {
    flex: 0 0 auto;
}

.client-activity-note {
    width: 100%;
    resize: vertical;
    min-height: 96px;
}

/* Time Tracking */
.time-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin: 2rem 0;
}

.time-day {
    background: white;
    padding: 1rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.time-day-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.time-day.weekend {
    background: var(--primary-silver);
}

.time-entry {
    background: rgba(0, 178, 204, 0.1);
    border-left: 3px solid var(--primary-cyan);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.time-entry:hover {
    background: rgba(0, 178, 204, 0.2);
}

.time-entry-project {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.time-entry-hours {
    color: var(--text-gray);
}

/* Financial Pages */
.financial-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.invoice-actions {
    display: flex;
    gap: 0.5rem;
}

/* Admin Pages */
.admin-section {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.admin-section-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.admin-section-body {
    padding: 2rem;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Compact stats grid variant (Offers) */
.stats-grid--compact {
    /* Keep four tiles on one row on desktop */
    grid-template-columns: repeat(4, minmax(200px, 1fr));
    gap: 1rem;
}

.stats-grid--compact .stat-card {
    padding: 1rem;
}

.stats-grid--compact .stat-header { margin-bottom: 0.5rem; }
.stats-grid--compact .stat-icon { width: 28px; height: 28px; font-size: 1rem; }
.stats-grid--compact .stat-value { font-size: 1.75rem; }

.stat-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: all 0.2s ease;
    position: relative;
    display: block; /* ensure vertical stacking to avoid label overlap */
}

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

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

.stat-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.blue {
    background: rgba(0, 188, 212, 0.1);
}

.stat-icon.green {
    background: rgba(76, 175, 80, 0.1);
}

.stat-icon.orange {
    background: rgba(255, 152, 0, 0.1);
}

.stat-icon.red {
    background: rgba(244, 67, 54, 0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    line-height: 1;
}

/* Align numeric values to the right for better readability */
.stat-card .stat-value { text-align: right; }

.stat-change {
    font-size: 0.875rem;
    color: var(--text-gray);
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* Prevent overflow in stats widgets */
.stat-header { min-width: 0; }
.stat-title, .stat-change { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Allow horizontal scrolling for wide S-curve SVGs */
#projectSCurve { overflow-x: auto; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid { grid-template-columns: 1fr; }
    .stats-grid--two-col { grid-template-columns: 1fr; }
    
    .time-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-actions {
        flex-direction: column;
    }
    
    .quick-action-card {
        flex-direction: row;
        text-align: left;
        min-width: auto;
    }
    
    .quick-action-icon {
        margin-bottom: 0;
        margin-right: 1rem;
    }
}

/* Offers table layout and overflow control */
.table.offers-table { table-layout: fixed; min-width: 1720px; }
.offers-table th, .offers-table td { overflow: hidden; }
.offers-table .col-number { width: 140px; }
.offers-table .col-client { width: 280px; }
.offers-table .col-title { width: 420px; }
.offers-table .col-amount { width: 140px; text-align: right; }
.offers-table .col-created { width: 140px; }
.offers-table .col-valid { width: 140px; }
.offers-table .col-status { width: 120px; }
.offers-table .col-actions { width: 400px; margin-right: 20px; }
/* Keep action buttons on one line inside actions column */
.offers-table td.col-actions { white-space: nowrap; }
.offers-table td.col-actions > div { display: flex; flex-wrap: nowrap; gap: 0.25rem; }

@media (max-width: 1024px) {
  .offers-table .col-title { width: 300px; }
  .offers-table .col-client { width: 220px; }
}
@media (max-width: 768px) {
  .offers-table .col-title { width: 220px; }
  .offers-table .col-client { width: 180px; }
  .offers-table .col-actions { width: 270px; margin-right: 20px; }
}

/* Invoices Page Styles */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.bg-info {
    background: var(--info-light);
    color: var(--info-color);
}

.stat-icon.bg-success {
    background: var(--success-light);
    color: var(--success-color);
}

.stat-icon.bg-warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.stat-icon.bg-danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-gray);
    font-weight: 500;
}

/* Compact stats for Time Tracking: fit tiles in one row */
.stats-container.compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}
.stats-container.compact .stats-card {
    padding: 0.875rem;
}
.stats-container.compact .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.1rem;
}
.stats-container.compact .stat-number {
    font-size: 1.35rem;
}
.stats-container.compact .stat-label {
    font-size: 0.78rem;
}

.financial-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.financial-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.financial-card h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-gray);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.financial-card .amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.filters-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.filters-row {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dark);
}

.table-section {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.table-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.line-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.line-item:last-child {
    margin-bottom: 0;
}

.line-total {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.totals-section {
    background: var(--gray-50);
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.totals-row.total-row {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.form-section {
    margin-bottom: 2rem;
}

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

.form-section-header h6 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.line-items-container {
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .financial-overview {
        grid-template-columns: 1fr;
    }
    
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
}

/* Settings Page Styles */
.settings-container {
    max-width: 800px;
    margin: 0 auto;
}

.settings-container .card {
    margin-bottom: 2rem;
}

.form-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.custom-control {
    position: relative;
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.custom-control-input {
    position: absolute;
    left: 0;
    z-index: -1;
    width: 1rem;
    height: 1.25rem;
    opacity: 0;
}

.custom-checkbox .custom-control-label::before {
    border-radius: 0.25rem;
}

.custom-control-label {
    position: relative;
    margin-bottom: 0;
    vertical-align: top;
}

.custom-control-label::before {
    position: absolute;
    top: 0.25rem;
    left: -1.5rem;
    display: block;
    width: 1rem;
    height: 1rem;
    pointer-events: none;
    content: "";
    background-color: #fff;
    border: 1px solid var(--border-color);
}

.custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--primary-cyan);
    border-color: var(--primary-cyan);
}

.custom-checkbox .custom-control-input:checked ~ .custom-control-label::after {
    position: absolute;
    top: 0.25rem;
    left: -1.5rem;
    display: block;
    width: 1rem;
    height: 1rem;
    content: "";
    background: no-repeat 50% / 50% 50%;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e");
}
/* Dashboard Project Card Clickable Style */
.project-card[data-project-id] {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card[data-project-id]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Inline form (compact row for widgets) */
.inline-form .form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.inline-form .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

/* Widget metrics under quick time entry */
.widget-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}
.widget-metrics .metric {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    background: var(--primary-silver);
    border-radius: 8px;
    padding: 10px 12px;
}
.widget-metrics .metric-label {
    color: var(--text-gray);
    font-size: 0.85rem;
}
.widget-metrics .metric-value {
    font-weight: 700;
    color: var(--text-dark);
}

/* Dashboard widgets drag & drop */
.card[data-widget-id], .stat-card[data-widget-id], .stats-grid[data-widget-id] {
    position: relative;
}
.widget-handle {
    margin-left: auto;
    color: var(--text-gray);
    cursor: grab;
    user-select: none;
    font-weight: 700;
}
.card.dragging, .stat-card.dragging {
    opacity: 0.6;
}

/* Visual placeholder location while dragging (optional) */
.drag-placeholder {
    border: 2px dashed var(--primary-cyan);
    border-radius: 10px;
    min-height: 80px;
}

/* Edge resize handles (only active in customize mode) */
.resize-edge {
    display: none;
    position: absolute;
    z-index: 2;
}
.resize-edge-right {
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
}
.resize-edge-bottom {
    left: 0;
    bottom: 0;
    width: 100%;
    height: 8px;
    cursor: ns-resize;
}
.page.customize-mode .resize-edge { display: block; }

/* Grid ruler overlay for vertical snapping visibility */
.grid-ruler {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        to bottom,
        rgba(0, 178, 204, 0.12) 0,
        rgba(0, 178, 204, 0.12) 1px,
        transparent 1px,
        transparent var(--row-unit, 12px)
    );
}

/* Vertical column guides overlay */
.grid-guides {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem; /* will be overridden dynamically to match grid gap */
    pointer-events: none;
}
.grid-guides .grid-guide-col {
    border-left: 1px dashed rgba(0, 178, 204, 0.25);
}
.grid-guides .grid-guide-col:last-child {
    border-right: 1px dashed rgba(0, 178, 204, 0.25);
}

/* Grid controls */
.grid-controls {
    position: absolute;
    right: 8px;
    top: -36px;
    background: #fff;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
    padding: 4px 6px;
    display: none;
    gap: 4px;
    align-items: center;
    z-index: 5;
}
.page.customize-mode .grid-controls { display: inline-flex; }
.grid-controls .label { color: var(--text-gray); font-size: 11px; margin-right: 4px; }
.grid-btn {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-dark);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}
.grid-btn.active { border-color: var(--primary-cyan); color: var(--primary-cyan); }

/* Notes tab */
.notes-layout {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: stretch;
    min-height: calc(100vh - 280px);
    background: linear-gradient(135deg, #f7fbff 0%, #ffffff 45%, #f6fffb 100%);
    padding: 0.25rem;
    border-radius: 12px;
}
.notes-column {
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}
.notes-sections,
.notes-pages {
    flex: 0 0 240px;
}
.notes-column.notes-column-collapsed {
    flex: 0 0 140px;
    min-height: 160px;
}
.notes-column.notes-column-collapsed .notes-list {
    display: none;
}
.notes-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.notes-collapsed-message {
    display: none;
    flex: 1;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-gray);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
}
.notes-column.notes-column-collapsed .notes-collapsed-message {
    display: flex;
}
.notes-collapse-toggle {
    width: 32px;
    padding: 0.15rem 0.25rem;
}
.notes-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.notes-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
}
.notes-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s, border 0.2s, transform 0.1s ease;
}
.notes-list-item.active {
    border-color: var(--primary);
    background: linear-gradient(90deg, rgba(0, 170, 170, 0.12) 0%, rgba(0, 170, 170, 0.06) 100%);
}
.notes-list-item:hover {
    border-color: var(--border-color);
    background: rgba(0, 0, 0, 0.03);
    transform: translateY(-1px);
}
.note-item-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.note-inline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.note-inline-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    flex: 1;
}
.note-inline-display {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-color);
    margin-right: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}
.notes-list-item:hover .note-inline-display {
    background: rgba(0, 170, 170, 0.06);
}
.note-inline-input {
    display: none;
    width: 100%;
    font-size: 0.92rem;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.notes-list-item.editing .note-inline-display {
    display: none;
}
.notes-list-item.editing .note-inline-input {
    display: block;
}
.note-item-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-color);
    margin-right: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.note-item-actions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.note-item-actions {
    opacity: 0.75;
    transition: opacity 0.15s ease;
}
.notes-list-item:hover .note-item-actions,
.notes-list-item.active .note-item-actions {
    opacity: 1;
}
.note-count-badge {
    background: var(--primary-silver);
    color: var(--text-color);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    border: 1px solid rgba(0,0,0,0.05);
}
.note-item-subtext {
    color: var(--text-gray);
    font-size: 0.82rem;
}
.notes-column.notes-editor-column {
    flex: 1 1 380px;
    min-height: 0;
}
.notes-editor-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    height: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    box-shadow: 0 12px 36px rgba(0,0,0,0.04);
}
.note-editor {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    min-height: 260px;
    overflow-y: auto;
    line-height: 1.6;
}
.note-editor[contenteditable="true"]:focus {
    outline: 2px solid var(--primary);
}
.note-editor[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: var(--text-gray);
}
.notes-toolbar {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.notes-toolbar-group {
    display: inline-flex;
    gap: 0.25rem;
}
.notes-toolbar.read-only {
    font-size: 0.85rem;
    color: var(--text-gray);
    background: var(--primary-silver);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}
.notes-editor-empty {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex: 1;
}
.note-meta {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
    color: var(--text-gray);
    font-size: 0.88rem;
}
.note-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3f6fb;
    border: 1px solid var(--border-color);
    line-height: 1.2;
}
.note-status {
    font-size: 0.85rem;
    color: var(--text-gray);
    min-height: 1rem;
}

/* Size badge while resizing */
.size-badge {
    position: absolute;
    top: 8px;
    left: 12px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1.6;
    z-index: 3;
    display: none;
}
.size-badge.active { display: inline-block; }

.tile-handle {
    position: absolute;
    top: 8px;
    right: 8px;
    color: var(--text-gray);
    cursor: grab;
    user-select: none;
    font-weight: 700;
    font-size: 12px;
}

/* Hide handles by default; show in customize mode */
.page .widget-handle, .page .tile-handle { display: none; }
.page.customize-mode .widget-handle, .page.customize-mode .tile-handle { display: inline-block; }
