/* =============================================================
   Cards and panels — shared standard.

   Card radius, border, padding and elevation were declared per page
   (radii of 8/10/12/14/16/18px and four different shadows). The
   tokens give one set; .card picks them up so existing markup is
   consistent without needing new classes.
   ============================================================= */

.card {
    background: var(--surface);
    color: var(--color-text);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: var(--space-4) var(--space-5);
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--color-text);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    background: transparent;
    border-top: 1px solid var(--border-color);
}

.card-title {
    text-wrap: pretty;
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    margin-bottom: var(--space-2);
    color: var(--color-text);
}

.card-subtitle,
.fg-card-muted {
    line-height: var(--lh-relaxed);
    font-size: var(--fs-md);
    color: var(--text-muted);
}

/* Nested cards do not stack shadows. */
.card .card {
    box-shadow: none;
}

/* A card that holds a table clips it, so header backgrounds, sticky
   headers and scrollbars stay inside the rounded corners — the same
   shell-clips rule used by modals. */
.card > .table-responsive:first-child,
.card > .fg-table-scroll:first-child {
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.card > .table-responsive:last-child,
.card > .fg-table-scroll:last-child {
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

/* ---------- Metric cards ----------
   The row of summary tiles at the top of a page. Employee Access
   introduced this tile and Employees and Workforce Mobility use the same
   one, so it is defined once here instead of in three page <style>
   blocks under the colliding name .summary-card (Recruitment has its own,
   structurally different .summary-card).

   The values are Employee Access's: 1px border, 16px radius, the small
   elevation, a 48px / 12px icon tile and 20px 24px body padding - now
   expressed with the shared tokens. The grid keeps the tiles equal width
   with one gap, and steps down to two columns on tablet and one on phone.

   Markup:
     <div class="app-metric-grid">
       <div class="app-metric-card">
         <div class="app-metric-card-body">
           <div class="app-metric-icon app-metric-icon--blue"><i ...></i></div>
           <div>
             <div class="app-metric-label">Total Employees</div>
             <div class="app-metric-value">42</div>
             <div class="app-metric-hint">All employee records</div>
           </div>
         </div>
       </div>
       ...
     </div>
   ---------------------------------- */
.app-metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.app-metric-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.app-metric-card-body {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
}

.app-metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

    /* Sized for both icon sets the app uses: Bootstrap Icons (a font) and
       Lucide (an inline svg). */
    .app-metric-icon > i:not([data-lucide]) {
        font-size: 22px;
        line-height: 1;
    }

    .app-metric-icon > svg,
    .app-metric-icon > [data-lucide] {
        width: 26px;
        height: 26px;
    }

.app-metric-icon--blue {
    background: rgba(59, 130, 246, .15);
    color: var(--theme-primary-text, #2563eb);
}

.app-metric-icon--green {
    background: rgba(16, 185, 129, .15);
    color: var(--theme-success-text, #059669);
}

.app-metric-icon--amber {
    background: rgba(245, 158, 11, .15);
    color: var(--theme-warning-text, #d97706);
}

.app-metric-icon--slate {
    background: rgba(107, 114, 128, .15);
    color: var(--theme-text-secondary, #4b5563);
}

.app-metric-label {
    font-size: var(--fs-md);
    line-height: var(--lh-normal);
    color: var(--text-muted);
}

.app-metric-value {
    font-size: 28px;
    font-weight: var(--fw-bold);
    line-height: var(--lh-tight);
    color: var(--color-text);
}

.app-metric-hint {
    font-size: var(--fs-xs);
    line-height: var(--lh-normal);
    color: var(--text-muted);
}

@media (max-width: 991.98px) {
    .app-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575.98px) {
    .app-metric-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-metric-card-body {
        padding: var(--space-4) var(--space-5);
    }
}

/* ---------- Page header ----------
   .page-header lives in css/design-button.css; only the spacing
   rhythm below it is normalised here. */
.fg-page-section {
    margin-bottom: var(--space-6);
}

.fg-section-title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    color: var(--color-text);
    margin: 0 0 var(--space-3);
}

.fg-section-subtitle {
    font-size: var(--fs-md);
    color: var(--text-muted);
    margin: 0 0 var(--space-4);
}

@media (max-width: 575.98px) {
    .card-body {
        padding: var(--space-4);
    }

    .card-header,
    .card-footer {
        padding: var(--space-3) var(--space-4);
    }
}
