/* ============================================================================
   Daybreak — dashboard widgets paint layer
   ----------------------------------------------------------------------------
   Loaded AFTER each per-partial stylesheet (support.css, quick_overview.css,
   projects_summary.css, invoices_dashboard.css, attention_points.css) so its
   rules win the cascade on shared selectors. The goal is one calmer, token-
   driven look across every customer-dashboard widget — matching the
   .doc-preview-wrap / .card-element.page-section chrome we use on public
   document preview pages and customer list pages.

   All colors come from canonical daybreak tokens defined in _tokens.css, so
   light/dark mode flips with no extra rules.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   .dashboard-pack — masonry-style paired-widget container

   Uses CSS columns to flow short and tall widgets top-to-bottom in each
   column, packing tightly without the vertical gaps that Bootstrap rows of
   col-md-6 introduce when adjacent panels differ in height.
   --------------------------------------------------------------------------- */
.dashboard-pack {
    columns: 1;
    column-gap: 1.25rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 992px) {
    .dashboard-pack {
        columns: 2;
    }
}

.dashboard-pack-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: block;
    margin-bottom: 1.25rem;
}

.dashboard-pack-item > .panel_s {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
   Shared dashboard surface — paints the inner widgets inside .panel_s panels
   --------------------------------------------------------------------------- */
.dashboard-section .panel-heading {
    background: transparent;
    border-bottom: 1px solid var(--border-soft);
    padding: 1rem 1.25rem;
}

.dashboard-section .panel-title.section-title,
.dashboard-section .section-title {
    color: var(--text-heading);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.dashboard-section .panel-title.section-title > i,
.dashboard-section .section-title > i {
    color: var(--accent-color);
}

.dashboard-section .panel-body {
    padding: 1.25rem;
}

/* ---------------------------------------------------------------------------
   Support widget — recolor with daybreak tokens, drop heavy gradients
   --------------------------------------------------------------------------- */
.support-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 0;
}

.support-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: none;
    overflow: hidden;
    transition: transform var(--transition-speed) var(--ease-standard),
                box-shadow var(--transition-speed) var(--ease-standard),
                border-color var(--transition-speed) var(--ease-standard);
    animation: none;
    opacity: 1;
    transform: none;
    cursor: default;
}

.support-card::before {
    display: none;
}

.support-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    border-color: var(--accent-color);
}

.support-card-header {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    gap: 0.75rem;
}

.support-card-body {
    padding: 1rem;
}

.ticket-id {
    color: var(--text-heading);
}

.ticket-status {
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    border-radius: var(--radius-full);
    padding: 0.2rem 0.65rem;
    font-size: 0.72rem;
    border: 1px solid transparent;
}

/* Status pills mapped to daybreak status tokens.
   1=open, 2=in_progress, 3=answered, 4=on_hold, 5=closed */
.ticket-status.status-1 {
    background: var(--info-tint);
    color: var(--info-color);
    border-color: var(--info-tint);
}
.ticket-status.status-2 {
    background: var(--warning-tint);
    color: var(--warning-color);
    border-color: var(--warning-tint);
}
.ticket-status.status-3 {
    background: var(--success-tint);
    color: var(--success-color);
    border-color: var(--success-tint);
}
.ticket-status.status-4 {
    background: var(--warning-tint);
    color: var(--warning-color);
    border-color: var(--warning-tint);
}
.ticket-status.status-5 {
    background: var(--border-soft);
    color: var(--text-muted);
    border-color: var(--border-soft);
}

.ticket-priority.priority-1 { color: var(--success-color); }
.ticket-priority.priority-2 { color: var(--warning-color); }
.ticket-priority.priority-3 { color: var(--danger-color);  }

.ticket-title h4 {
    color: var(--text-heading);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
}

.ticket-department {
    background: var(--border-soft);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

.message-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-soft) !important;
    border-radius: var(--radius-sm);
    padding: 0.85rem 0.9rem;
    margin: 0;
    box-shadow: none !important;
    transition: none !important;
}

.message-preview.original-message,
.message-preview.latest-reply {
    background: var(--bg-card);
    box-shadow: none !important;
}

.message-preview:hover {
    transform: none !important;
    box-shadow: none !important;
}

.preview-content {
    gap: 0.5rem;
}

.preview-label {
    background: var(--bg-elevated) !important;
    color: var(--text-muted) !important;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    box-shadow: none;
    border: 1px solid var(--border-soft);
}

.message-preview p {
    color: var(--text-main);
    font-size: 0.85rem;
}

.ticket-footer {
    border-top: 1px solid var(--border-soft);
    padding-top: 0.75rem;
}

.ticket-stats {
    gap: 0.5rem;
}

.assigned-to {
    background: var(--border-soft);
    color: var(--text-muted);
}

.admin-unread {
    background: var(--warning-tint);
    color: var(--warning-color);
    border: 1px solid transparent;
}

.client-unread {
    background: var(--info-tint);
    color: var(--info-color);
    border: 1px solid transparent;
}

.support-actions {
    background: transparent;
    border-top: 1px solid var(--border-soft);
    border-radius: 0;
    padding: 1.25rem 0 0;
    margin-top: 1.25rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.support-actions .btn,
.btn-view-all,
.btn-create-ticket {
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    box-shadow: none;
    background: var(--accent-color) !important;
    color: var(--btn-principal-text) !important;
    border: 1px solid var(--accent-color) !important;
}

.support-actions .btn-view-all {
    background: var(--bg-elevated) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

.support-actions .btn:hover,
.btn-view-all:hover,
.btn-create-ticket:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    background: var(--accent-hover) !important;
    color: var(--btn-principal-text) !important;
}

.support-actions .btn-view-all:hover {
    background: var(--border-soft) !important;
    color: var(--text-heading) !important;
    border-color: var(--border-color) !important;
}

.support-actions .btn::before {
    display: none;
}

/* Support empty state — match doc-preview's empty-state feel */
.support-empty-state {
    background: var(--bg-elevated);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    text-align: center;
}

.support-empty-state .empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--btn-principal-text);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: none;
}

.support-empty-state .empty-content h4 {
    color: var(--text-heading);
    font-size: 1.05rem;
}

.support-empty-state .empty-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.support-empty-state .btn,
.support-empty-state .btn-accent,
.support-empty-state .btn-create-ticket {
    background: var(--accent-color) !important;
    color: var(--btn-principal-text) !important;
    border: 1px solid var(--accent-color) !important;
    padding: 0.55rem 1.25rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    box-shadow: none;
}

.support-empty-state .btn:hover,
.support-empty-state .btn-accent:hover,
.support-empty-state .btn-create-ticket:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------------------
   Attention Points widget
   --------------------------------------------------------------------------- */
.attention-points-section,
.attention-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.attention-card,
.attention-point-card,
.attention-point {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: none;
    transition: transform var(--transition-speed) var(--ease-standard),
                border-color var(--transition-speed) var(--ease-standard);
}

.attention-card:hover,
.attention-point-card:hover,
.attention-point:hover {
    transform: translateY(-1px);
    border-color: var(--accent-color);
}

.attention-badge {
    background: var(--warning-tint);
    color: var(--warning-color);
    border-radius: var(--radius-full);
    padding: 0.15rem 0.6rem;
    font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Quick Overview widget — calmer card/tile look
   --------------------------------------------------------------------------- */
.quick-overview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

.overview-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: none;
}

.overview-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.overview-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--primary-tint);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.overview-title h4 {
    margin: 0;
    color: var(--text-heading);
    font-size: 0.95rem;
    font-weight: 600;
}

.overview-subtitle {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.overview-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.stat-row .stat-label {
    color: var(--text-muted);
}

.stat-row .stat-value {
    color: var(--text-heading);
    font-weight: 600;
}

.stat-row .stat-value.success { color: var(--success-color); }
.stat-row .stat-value.warning { color: var(--warning-color); }
.stat-row .stat-value.danger  { color: var(--danger-color);  }
.stat-row .stat-value.info    { color: var(--info-color);    }

.overview-progress {
    margin-top: 0.75rem;
}

.overview-progress .progress {
    height: 6px;
    background: var(--border-soft);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.overview-progress .progress-bar {
    background: var(--accent-color);
    transition: width 0.6s var(--ease-out-soft);
}

.overview-progress .progress-text {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.overview-actions {
    margin-top: 0.85rem;
}

.overview-actions .btn,
.overview-actions .btn-outline-primary,
.overview-actions .btn-outline-warning {
    background: var(--bg-card);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.overview-actions .btn:hover {
    background: var(--accent-color);
    color: var(--btn-principal-text);
}

/* ---------------------------------------------------------------------------
   Projects Summary widget
   --------------------------------------------------------------------------- */
.projects-stats .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.projects-stats .stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    box-shadow: none;
}

.projects-stats .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--primary-tint);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.projects-stats .stat-content .stat-number {
    margin: 0;
    color: var(--text-heading);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.projects-stats .stat-content .stat-label {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.projects-list .section-subtitle {
    color: var(--text-heading);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-soft);
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.project-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.project-card-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
}

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

.project-title h4 {
    margin: 0;
    color: var(--text-heading);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
}

.project-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.18rem 0.6rem;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    margin-left: 0.5rem;
    display: inline-block;
}

.project-status.status-1 {
    background: var(--border-soft);
    color: var(--text-muted);
}
.project-status.status-2 {
    background: var(--info-tint);
    color: var(--info-color);
}
.project-status.status-3 {
    background: var(--warning-tint);
    color: var(--warning-color);
}
.project-status.status-4 {
    background: var(--success-tint);
    color: var(--success-color);
}
.project-status.status-5 {
    background: var(--danger-tint);
    color: var(--danger-color);
}

.project-meta {
    margin-top: 0.45rem;
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.project-date,
.project-deadline {
    color: var(--text-muted);
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.projects-empty-state {
    background: var(--bg-elevated);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    text-align: center;
}

.projects-empty-state .empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--btn-principal-text);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.projects-empty-state .empty-content h4 {
    color: var(--text-heading);
    font-size: 1.05rem;
}

.projects-empty-state .empty-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
   Invoices Dashboard widget — tone down the heavy embedded style
   --------------------------------------------------------------------------- */
.invoices-dashboard {
    gap: 1rem;
}

.invoices-dashboard .charts-section,
.invoices-dashboard .latest-invoices-section {
    margin: 0;
}

.invoices-dashboard .chart-card,
.invoices-dashboard .latest-invoices-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: none;
    animation: none;
}

.invoices-dashboard .chart-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-color);
}

.invoices-dashboard .section-header {
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 0.6rem;
    margin-bottom: 0.85rem;
}

.invoices-dashboard .section-header h4 {
    color: var(--text-heading);
    font-size: 0.95rem;
    font-weight: 600;
}

.invoices-dashboard .view-all-link {
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.invoices-dashboard .invoice-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    box-shadow: none;
    animation: none;
    opacity: 1;
    transform: none;
}

.invoices-dashboard .invoice-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: var(--accent-color);
}

/* Calm down the pulsing overdue/due-today badges — keep color signal, drop animation */
.invoices-dashboard .invoice-overdue,
.invoices-dashboard .invoice-due-today,
.invoices-dashboard .invoice-soon-due {
    animation: none !important;
}

.invoices-dashboard .invoice-overdue::before,
.invoices-dashboard .invoice-due-today::before {
    animation: none !important;
}

.invoices-dashboard .invoice-overdue .invoice-status,
.invoices-dashboard .invoice-due-today .invoice-status,
.invoices-dashboard .invoice-soon-due .invoice-status {
    animation: none !important;
}

.invoices-dashboard .invoice-status {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
}

.invoices-dashboard .status-1 { background: var(--warning-tint); color: var(--warning-color); }
.invoices-dashboard .status-2 { background: var(--success-tint); color: var(--success-color); }
.invoices-dashboard .status-3 { background: var(--info-tint);    color: var(--info-color);    }
.invoices-dashboard .status-4 { background: var(--danger-tint);  color: var(--danger-color);  }
.invoices-dashboard .status-5 { background: var(--border-soft);  color: var(--text-muted);    }

.invoices-dashboard .amount-value {
    color: var(--text-heading);
    font-size: 1.15rem;
}

.invoices-dashboard .btn-view,
.invoices-dashboard .btn-pay {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
}

.invoices-dashboard .btn-view {
    background: var(--bg-elevated);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
}

.invoices-dashboard .btn-view:hover {
    background: var(--accent-color);
    color: var(--btn-principal-text);
}

.invoices-dashboard .btn-pay {
    background: var(--success-color);
    color: var(--btn-principal-text);
}

.invoices-dashboard .empty-state {
    background: var(--bg-elevated);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    text-align: center;
}

.invoices-dashboard .empty-state .empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-color);
    color: var(--btn-principal-text);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.invoices-dashboard .empty-state h5 {
    color: var(--text-heading);
    font-size: 1.05rem;
}

.invoices-dashboard .empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------------------
   Inline Files widget (home.php)
   --------------------------------------------------------------------------- */
[data-dashboard-section="files"] .list-group-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

[data-dashboard-section="files"] .list-group-item:last-child {
    margin-bottom: 0;
}

[data-dashboard-section="files"] .list-group-item small {
    color: var(--text-muted);
}

[data-dashboard-section="files"] .text-muted i.fa-folder-open {
    color: var(--accent-color);
    opacity: 0.7;
}

/* ---------------------------------------------------------------------------
   Quick Actions tiles
   --------------------------------------------------------------------------- */
.quick-actions-grid {
    margin: 0;
    row-gap: 0.85rem;
}

.quick-action-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    gap: 0.85rem;
    align-items: center;
    color: var(--text-main);
    text-decoration: none;
    transition: transform var(--transition-speed) var(--ease-standard),
                border-color var(--transition-speed) var(--ease-standard),
                box-shadow var(--transition-speed) var(--ease-standard);
    height: 100%;
}

.quick-action-card:hover,
.quick-action-card:focus {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
    text-decoration: none;
}

.quick-action-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--primary-tint);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.quick-action-text h4 {
    margin: 0;
    color: var(--text-heading);
    font-size: 0.95rem;
    font-weight: 600;
}

.quick-action-text p {
    margin: 0.15rem 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ---------------------------------------------------------------------------
   Section-level header pull-right action button
   --------------------------------------------------------------------------- */
.dashboard-section .section-actions .btn-default {
    background: var(--bg-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.dashboard-section .section-actions .btn-default:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.dashboard-section .section-actions .btn-primary {
    background: var(--accent-color);
    color: var(--btn-principal-text);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.dashboard-section .section-actions .btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

/* ---------------------------------------------------------------------------
   Calendar widget — tone down the inline FullCalendar wrappers
   --------------------------------------------------------------------------- */
[data-dashboard-section="calendar"] .calendar-header {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

[data-dashboard-section="calendar"] .calendar-nav .btn,
[data-dashboard-section="calendar"] .calendar-actions .btn {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

[data-dashboard-section="calendar"] .view-btn.active {
    background: var(--accent-color);
    color: var(--btn-principal-text);
    border-color: var(--accent-color);
}

[data-dashboard-section="calendar"] .period-btn h4 {
    margin: 0;
    color: var(--text-heading);
    font-size: 0.95rem;
    font-weight: 600;
}

[data-dashboard-section="calendar"] .weekday {
    color: var(--text-muted);
    font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Recent Activity list
   --------------------------------------------------------------------------- */
.activity-list .activity-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    padding: 0.65rem 0.85rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

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

.activity-list .activity-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary-tint);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-list .activity-title {
    color: var(--text-main);
    font-size: 0.85rem;
    line-height: 1.35;
}

.activity-list .activity-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.2rem;
}

/* ---------------------------------------------------------------------------
   Dark-mode adjustments
   The token aliases already flip surface/text/border colors in dark mode,
   so most rules above just work. A few rules with hard-coded body.dark
   selectors in support.css used now-unused tokens (--dark-card-bg,
   --dark-border-light); neutralize them so they don't override.
   --------------------------------------------------------------------------- */
body.dark .support-card,
body.dark .support-card-header,
body.dark .support-empty-state {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

body.dark .message-preview,
body.dark .assigned-to,
body.dark .ticket-department {
    background: var(--bg-card);
}

body.dark .support-actions {
    border-top-color: var(--border-soft);
    background: transparent;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (min-width: 768px) {
    .support-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
    .quick-overview-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-section .panel-body {
        padding: 1rem;
    }
    .overview-stats {
        grid-template-columns: 1fr;
    }
}

/* ===========================================================================
   Profile page — /clients/profile

   Paints the profile-image upload block, the notifications checkbox grid,
   the form-actions row, and the password-info card so /clients/profile
   reads with the same daybreak surface as the rest of the customer portal.
   =========================================================================== */

/* Profile image block */
.profile-image-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
}

.profile-image-display {
    position: relative;
    width: 120px;
    height: 120px;
}

.profile-image-thumb {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-color);
    box-shadow: var(--shadow-soft);
    display: block;
}

.profile-image-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--danger-color);
    color: var(--btn-principal-text);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition-speed) var(--ease-standard);
}

.profile-image-remove:hover {
    transform: scale(1.08);
    color: var(--btn-principal-text);
    background: var(--danger-color);
    filter: brightness(0.92);
}

.profile-image-upload {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.profile-image-input {
    display: none;
}

.profile-image-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-elevated);
    color: var(--text-main);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    transition: border-color var(--transition-speed) var(--ease-standard),
                color var(--transition-speed) var(--ease-standard);
    align-self: flex-start;
}

.profile-image-label:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.profile-image-label i {
    color: var(--accent-color);
    font-size: 1.15rem;
}

.profile-image-preview {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--accent-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    align-self: flex-start;
}

.profile-image-preview .profile-image-thumb {
    width: 64px;
    height: 64px;
    border-width: 2px;
    box-shadow: none;
}

.profile-image-preview-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
    font-size: 0.875rem;
}

.profile-image-preview-remove {
    background: var(--danger-color);
    color: var(--btn-principal-text);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-speed) var(--ease-standard);
}

.profile-image-preview-remove:hover {
    transform: scale(1.1);
}

/* Notifications grid (checkbox tiles) */
.notifications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.6rem;
}

.notifications-grid .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    transition: border-color var(--transition-speed) var(--ease-standard),
                background var(--transition-speed) var(--ease-standard);
    margin: 0;
    font-weight: 400;
}

.notifications-grid .checkbox-wrapper:hover {
    border-color: var(--accent-color);
}

.notifications-grid .checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.notifications-grid .checkmark {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    flex-shrink: 0;
    position: relative;
    transition: background var(--transition-speed) var(--ease-standard),
                border-color var(--transition-speed) var(--ease-standard);
}

.notifications-grid .checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.notifications-grid .checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--btn-principal-text);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.notifications-grid .label-text {
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Profile form-actions row */
.profile-form-actions {
    text-align: right;
}

.profile-form-actions .btn {
    min-width: 160px;
}

/* Preferences (theme tiles + language select) */
.pref-theme-tiles {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.3rem;
    margin-bottom: 0.45rem;
}

.pref-theme-tile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.9rem 0.5rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    transition: border-color var(--transition-speed) var(--ease-standard),
                color var(--transition-speed) var(--ease-standard),
                background var(--transition-speed) var(--ease-standard);
    font: inherit;
    text-align: center;
}

.pref-theme-tile:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.pref-theme-tile.is-active {
    border-color: var(--accent-color);
    background: var(--primary-tint);
    color: var(--accent-color);
}

.pref-theme-tile-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.pref-theme-tile-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.pref-save-indicator {
    margin-top: 0.6rem;
    min-height: 1.25rem;
    font-size: 0.82rem;
    color: var(--success-color);
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity var(--transition-speed) var(--ease-standard),
                transform var(--transition-speed) var(--ease-standard);
}

.pref-save-indicator.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.pref-save-indicator.is-error {
    color: var(--danger-color);
}

/* Password card */
.profile-password-block {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: flex-start;
}

.profile-password-help {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-password-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-soft);
    width: 100%;
    margin-top: 0.5rem;
}

.profile-password-meta i {
    color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    .profile-form-actions {
        text-align: center;
    }
    .profile-form-actions .btn {
        width: 100%;
    }
    .notifications-grid {
        grid-template-columns: 1fr;
    }
}

/* ===========================================================================
   Contracts page (/clients/contracts)
   - .contracts-grid is CSS Grid in contracts.css. The view used to also
     carry .row + col-md-4, which clamped each grid item to ~33% of a
     400px grid track (~130px). The view has been changed to drop the
     Bootstrap column classes; the grid now lays out items natively.
   - .contracts-chart-wrap gives the doughnut chart a definite box so
     Chart.js (maintainAspectRatio:false) can size to it.
   =========================================================================== */
.contracts-grid > .contract-card-wrap {
    /* Defensive: even if something later re-adds col-* widths, do not
       let them clamp the grid items. */
    max-width: none;
    flex: none;
    width: auto;
}

.contracts-chart-wrap {
    position: relative;
    width: 100%;
    height: 280px;
    margin-top: 0.5rem;
}

/* Type breakdown — server-rendered list of contract types with a count
   and a percentage bar. Always renders, no Chart.js dependency. */
.contracts-type-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.5rem;
}

.contracts-type-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.contracts-type-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.contracts-type-name {
    color: var(--text-heading);
    font-weight: 600;
    font-size: 0.95rem;
}

.contracts-type-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.contracts-type-count strong {
    color: var(--text-heading);
}

.contracts-type-bar {
    width: 100%;
    height: 8px;
    background: var(--border-soft);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.contracts-type-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    border-radius: var(--radius-full);
    transition: width 0.6s var(--ease-out-soft);
}

@media (max-width: 768px) {
    .contracts-chart-wrap {
        height: 240px;
    }
}

/* ===========================================================================
   Header navbar language switcher — standalone globe button next to the
   theme switch. Reuses the existing .js-set-language click handler, so
   no extra JS is needed.
   =========================================================================== */
.app-header__lang-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.app-header__lang {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 0.4rem 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: background var(--transition-speed) var(--ease-standard),
                border-color var(--transition-speed) var(--ease-standard),
                color var(--transition-speed) var(--ease-standard);
    line-height: 1;
    font-size: 0.95rem;
}

.app-header__lang:hover,
.app-header__lang:focus {
    background: var(--bg-elevated);
    border-color: var(--border-color);
    color: var(--accent-color);
    outline: none;
}

.app-header__lang > i:first-child {
    font-size: 1.05rem;
}

.app-header__lang-current {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-heading);
}

.app-header__lang-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform var(--transition-speed) var(--ease-standard);
}

.app-header__lang-wrap.open .app-header__lang-chevron {
    transform: rotate(180deg);
}

.app-header__lang-menu {
    min-width: 180px;
    max-height: 320px;
    overflow-y: auto;
    margin-top: 0.4rem;
}

.app-header__lang-menu > li > a {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.95rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.88rem;
}

.app-header__lang-menu > li > a > i:first-child {
    width: 1rem;
    text-align: center;
    font-size: 0.85rem;
}

.app-header__lang-menu > li > a:hover,
.app-header__lang-menu > li > a:focus {
    background: var(--bg-elevated);
    color: var(--accent-color);
}

.app-header__lang-menu > li.active > a {
    color: var(--accent-color);
    font-weight: 600;
    background: var(--primary-tint);
}

/* Featured "main" languages — pinned to the top of the picker and
   highlighted with a subtle tinted background + a star icon. Applies
   to both the navbar globe dropdown and the user-dropdown submenu. */
.app-header__lang-menu > li.lang-main > a,
.header-language-menu > li.lang-main > a {
    background: color-mix(in srgb, var(--accent-color) 6%, transparent);
    font-weight: 600;
    color: var(--text-heading);
}

.app-header__lang-menu > li.lang-main > a:hover,
.app-header__lang-menu > li.lang-main > a:focus,
.header-language-menu > li.lang-main > a:hover,
.header-language-menu > li.lang-main > a:focus {
    background: var(--primary-tint);
    color: var(--accent-color);
}

.app-header__lang-menu > li.lang-main.active > a,
.header-language-menu > li.lang-main.active > a {
    background: var(--primary-tint);
    color: var(--accent-color);
}

.app-header__lang-menu .lang-main-icon,
.header-language-menu .lang-main-icon {
    color: var(--accent-color);
    font-size: 0.78rem;
}

/* National flag (inline SVG) on featured languages — fixed 22×15 box,
   keeps a thin border so light flags (Japan) read against the
   primary-tint background. SVG instead of Unicode emoji because Windows
   does not render regional-indicator pairs as flags. */
.app-header__lang-menu .lang-flag,
.header-language-menu .lang-flag {
    display: inline-block;
    width: 22px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    vertical-align: middle;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.app-header__lang-menu .lang-label,
.header-language-menu .lang-label {
    flex: 1;
}

.app-header__lang-menu .lang-check,
.header-language-menu .lang-check {
    font-size: 0.78rem;
    margin-left: 0.4rem;
}

.app-header__lang-menu .lang-divider,
.header-language-menu .lang-divider {
    margin: 0.25rem 0;
    border-top: 1px solid var(--border-color);
    list-style: none;
    height: 1px;
}

/* ===========================================================================
   Header user-dropdown language submenu

   Bootstrap 3 has no native dropdown-submenu — paint a small inline submenu
   that opens on click. Persistence happens via /theme/set_language_pref
   (contact meta + cookie); the JS in template_parts/header.php just POSTs
   and reloads. The current language is highlighted with a green check.
   =========================================================================== */
.header-language {
    position: relative;
}

.header-language > .header-language-toggle {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
}

.header-language > .header-language-toggle > i:first-child {
    width: 1rem;
    text-align: center;
}

.header-language-current {
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0;
    margin-left: auto;
}

.header-language.dropdown-submenu > .header-language-toggle::after {
    content: '\f107'; /* fa-chevron-down */
    font-family: 'Font Awesome 6 Free', 'FontAwesome', sans-serif;
    font-weight: 900;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.4rem;
    transition: transform var(--transition-speed) var(--ease-standard);
}

.header-language.dropdown-submenu.open > .header-language-toggle::after {
    transform: rotate(180deg);
}

.header-language-menu {
    display: none;
    list-style: none;
    margin: 0.35rem 0 0;
    padding: 0.35rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    max-height: 260px;
    overflow-y: auto;
}

.header-language.dropdown-submenu.open > .header-language-menu {
    display: block;
}

.header-language-menu > li {
    list-style: none;
    margin: 0;
}

.header-language-menu > li > a {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.95rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.88rem;
    transition: background var(--transition-speed) var(--ease-standard);
}

.header-language-menu > li > a:hover,
.header-language-menu > li > a:focus {
    background: var(--bg-elevated);
    color: var(--accent-color);
}

.header-language-menu > li.active > a {
    color: var(--accent-color);
    font-weight: 600;
    background: var(--primary-tint);
}

.header-language-menu > li > a > i:first-child {
    width: 1rem;
    text-align: center;
    font-size: 0.85rem;
}
