.dashboard-page {
    display: grid;
    gap: 16px;
}

.ai-phase2-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.ai-daily-brief,
.ai-health-score {
  border: 1px solid var(--border-color, #d8e2ef);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-muted, #f8fafc);
}

.ai-section-title h3 {
  font-size: 16px;
  margin: 0 0 10px;
}

.ai-brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-brand-title i {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in oklab, var(--accent-color, #2563eb) 13%, #fff);
  color: var(--accent-color, #2563eb);
  font-size: 14px;
}

.ai-brand-badge,
.ai-period-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid color-mix(in oklab, var(--accent-color, #2563eb) 24%, var(--border-color, #d8e2ef));
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent-color, #2563eb) 8%, #fff);
  color: var(--accent-color, #2563eb);
  font-size: 11px;
  font-weight: 800;
}

.ai-period-pill {
  margin-top: 8px;
  color: var(--text-color, #0f172a);
}

.ai-mini-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-mini-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border-color, #d8e2ef);
  border-radius: 8px;
  background: #fff;
}

.ai-brief-subtitle {
  margin: -2px 0 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.ai-mini-card i {
  grid-row: span 2;
  align-self: center;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in oklab, #2563eb 12%, #fff);
  color: #2563eb;
}

.ai-mini-card span,
.ai-message-list span {
  font-size: 12px;
  color: var(--muted-text, #64748b);
}

.ai-mini-card strong {
  font-size: 14px;
  color: var(--text-color, #0f172a);
}

.ai-message-list {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.ai-alert-suggestion-block {
  margin-top: 12px;
}

.ai-alert-suggestion-block h4,
.ai-health-reasons h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.ai-message-list span {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-height: 28px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--card-bg, #fff);
}

.ai-alerts span {
  color: #b45309;
  background: color-mix(in oklab, #f59e0b 9%, #fff);
}

.ai-suggestions span {
  color: #047857;
  background: color-mix(in oklab, #10b981 8%, #fff);
}

.ai-message-list b {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  line-height: 1.4;
  white-space: nowrap;
}

.ai-alerts b {
  background: #b45309;
}

.ai-suggestions b {
  background: #047857;
}

.ai-health-meter {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.ai-health-meter strong {
  font-size: 34px;
  line-height: 1;
}

.ai-health-meter small {
  margin-left: 4px;
  font-size: 14px;
  color: var(--text-muted);
}

.ai-health-status {
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in oklab, #16a34a 14%, #fff);
  color: #047857;
  font-size: 12px;
  font-weight: 800;
}

.ai-health-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 8px;
}

.ai-health-bar span {
  display: block;
  height: 100%;
  background: #2563eb;
}

.ai-health-stars {
  display: inline-flex;
  gap: 5px;
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 8px;
}

.ai-health-stars .active {
  color: #16a34a;
}

.ai-period-note {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .ai-phase2-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-owner-warning,
.master-integrity-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid color-mix(in oklab, var(--warning, #f59e0b) 38%, var(--border-color, #dbe3ee));
    border-radius: 14px;
    background: color-mix(in oklab, var(--warning, #f59e0b) 14%, var(--card-bg, #fff));
    color: var(--text-color, #0f172a);
    font-size: 13px;
    font-weight: 600;
}

.dashboard-owner-warning i,
.master-integrity-warning i {
    color: var(--warning, #f59e0b);
}

.dashboard-owner-warning span,
.master-integrity-warning span {
    flex: 1 1 auto;
}

.ai-insights-panel {
    display: grid;
    gap: 12px;
}

.ai-insights-content {
    display: grid;
    gap: 10px;
}

.ai-insight-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-insight-item {
    min-width: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
}

.ai-insight-item > i {
    grid-row: span 2;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: color-mix(in oklab, var(--accent-color, #2563eb) 12%, #fff);
    color: var(--accent-color, #2563eb);
}

.ai-insight-item strong {
    color: var(--text-color);
    font-size: 13px;
    font-weight: 800;
}

.ai-insight-item span {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
}

.ai-insight-item[data-severity="positive"] {
    border-color: color-mix(in oklab, var(--success, #16a34a) 35%, var(--border-color));
}

.ai-insight-item[data-severity="warning"] {
    border-color: color-mix(in oklab, var(--warning, #f59e0b) 45%, var(--border-color));
}

.ai-insight-item[data-severity="warning"] > i {
    background: color-mix(in oklab, var(--warning, #f59e0b) 14%, #fff);
    color: #b45309;
}

.ai-insight-item[data-severity="positive"] > i {
    background: color-mix(in oklab, var(--success, #16a34a) 14%, #fff);
    color: #047857;
}

.ai-insight-item[data-ai-type="expense"] > i {
    background: color-mix(in oklab, #f97316 13%, #fff);
    color: #c2410c;
}

.ai-insight-item[data-ai-type="doctor"] > i,
.ai-insight-item[data-ai-type="revenue"] > i {
    background: color-mix(in oklab, #2563eb 12%, #fff);
    color: #2563eb;
}

.ai-insight-item[data-ai-type="service"] > i,
.ai-insight-item[data-ai-type="growth"] > i {
    background: color-mix(in oklab, #16a34a 12%, #fff);
    color: #047857;
}

.ai-insight-item[data-ai-type="risk"] > i {
    background: color-mix(in oklab, #ef4444 12%, #fff);
    color: #dc2626;
}

.ai-source-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.ai-ask-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, .42);
}

.ai-ask-panel {
    width: min(720px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: var(--shadow-card-soft);
}

.ai-ask-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.ai-ask-header h2,
.ai-ask-header p {
    margin: 0;
}

.ai-question-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-question-list button,
.ai-question-btn {
    min-height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-color);
    padding: 0 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: normal;
}

.ai-question-btn > i {
    display: none;
}

.ai-question-btn.active {
    background: var(--accent-color, #2563eb);
    color: #ffffff;
    border-color: var(--accent-color, #2563eb);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.ai-question-btn.active i,
.ai-question-btn.active span {
    color: inherit;
}

.ai-question-btn.active > i {
    display: inline-block;
}

.ai-question-btn.is-loading {
    cursor: wait;
}

.ai-question-btn.is-loading::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: ai-question-spin .75s linear infinite;
}

.ai-question-btn:disabled:not(.active) {
    cursor: not-allowed;
    opacity: .62;
}

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

.ai-answer {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
}

.ai-answer-question {
    display: grid;
    gap: 3px;
}

.ai-answer-question span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}

.ai-answer-question strong {
    color: var(--text-color);
    font-size: 14px;
}

.ai-answer p {
    margin: 0;
    line-height: 1.5;
}

.ai-answer-says span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-color, #2563eb);
    font-size: 12px;
    font-weight: 800;
}

.ai-answer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.ai-answer-meta span {
    display: inline-flex;
    gap: 5px;
    min-height: 26px;
    align-items: center;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--text-muted);
    font-size: 11px;
}

.ai-answer-meta b {
    color: var(--text-color);
}

.ai-feedback-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.ai-feedback-row button {
    min-width: 64px;
    min-height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.ai-feedback-row button.active {
    border-color: var(--accent-color, #2563eb);
    background: color-mix(in oklab, var(--accent-color, #2563eb) 12%, #fff);
    color: var(--accent-color, #2563eb);
}

.ai-answer-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.ai-answer-card {
    display: grid;
    gap: 3px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

.dashboard-greeting-card {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1100;
    width: min(420px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 16px;
    border: 1px solid color-mix(in oklab, var(--accent-color, #2563eb) 40%, transparent);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: var(--shadow-card-soft);
}

.dashboard-greeting-card .greeting-icon {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: color-mix(in oklab, var(--accent-color, #2563eb) 22%, transparent);
    color: var(--accent-color);
}

.dashboard-greeting-card strong,
.dashboard-greeting-card p {
    display: block;
    margin: 0;
}

.dashboard-greeting-card p {
    margin-top: 4px;
    color: var(--text-muted);
    line-height: 1.45;
}

.dashboard-header,
.dashboard-panel,
.insight-strip,
.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.dashboard-header {
    min-height: 122px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    padding: 28px 30px;
    border-radius: 18px;
    border-width: 1px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    background: linear-gradient(130deg, color-mix(in oklab, var(--surface-muted, #f8fafc) 72%, transparent), var(--card-bg, #ffffff));
    isolation: isolate;
}

.dashboard-header::before {
    content: "";
    position: absolute;
    right: -36px;
    top: -54px;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background: color-mix(in oklab, var(--accent-color, #2563eb) 24%, transparent);
    filter: blur(20px);
    z-index: -1;
}

.dashboard-kicker {
    color: var(--accent-color);
    font-size: 12px;
    margin-top: 2px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dashboard-header h1 {
    margin: 2px 0 8px;
    color: var(--text-color);
    font-size: clamp(1.75rem, 2vw + 1rem, 2.4rem);
    line-height: 1.14;
    font-weight: 700;
}

.dashboard-header p,
.panel-header p,
.metric-label,
.activity-meta,
.kpi-dialog-header p {
    margin: 0;
    color: var(--text-muted);
    font-weight: 400;
}

.dashboard-title {
    margin: 0;
}

.dashboard-subtitle {
    margin: 0;
    max-width: 780px;
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.45;
    font-weight: 400;
}

.dashboard-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-period-filter,
.dashboard-custom-range {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dashboard-period-filter select,
.dashboard-custom-range input {
    min-height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--surface-muted);
    color: var(--text-color);
    padding: 0 12px;
    font: inherit;
    font-weight: 600;
}

.dashboard-custom-range input {
    width: 142px;
}

.icon-text-btn,
.primary-action,
.quick-actions button,
.icon-btn {
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
}

.icon-text-btn,
.primary-action {
    min-height: 40px;
    padding: 0 14px;
}

.icon-text-btn {
    background: var(--surface-muted);
    color: var(--text-color);
}

.primary-action {
    background: var(--primary-color, #2563eb);
    color: var(--text-color-inverse, #fff);
}

.insight-strip {
    min-height: 58px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    overflow-x: auto;
}

.insight-item {
    border: 0;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    white-space: nowrap;
}

button.insight-item {
    cursor: pointer;
    position: relative;
    padding-right: 34px;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

button.insight-item:hover,
button.insight-item.insight-actionable:hover {
    filter: brightness(1.08);
}

button.insight-item.insight-actionable {
    padding-right: 38px;
}

button.insight-item.insight-actionable:hover {
    transform: translateY(-1px);
}

.insight-item-arrow {
    margin-left: auto;
    opacity: .72;
    font-size: 11px;
}

.insight-warning {
    background: color-mix(in oklab, var(--warning, #f59e0b) 20%, transparent);
    color: var(--warning, #f59e0b);
}

.insight-danger {
    background: color-mix(in oklab, var(--danger, #ef4444) 20%, transparent);
    color: var(--danger, #ef4444);
}

.insight-success {
    background: color-mix(in oklab, var(--success, #10b981) 20%, transparent);
    color: var(--success, #10b981);
}

.insight-light {
    background: var(--surface-muted);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.employee-dashboard .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.employee-dashboard .dashboard-bottom-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, .7fr);
}

.superadmin-dashboard .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.superadmin-dashboard .metric-card {
    cursor: default;
}

.superadmin-dashboard .dashboard-kicker {
    color: var(--accent-color, #2563eb);
}

.d-none {
    display: none !important;
}

.metric-card {
    container-type: inline-size;
    min-height: 116px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    align-items: center;
    gap: 13px;
    padding: 16px;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    border-radius: 16px;
    border-color: color-mix(in srgb, var(--border-color) 78%, transparent);
    overflow: hidden;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
    position: relative;
    background:
        linear-gradient(145deg, color-mix(in oklab, var(--card-bg) 92%, var(--surface-muted)), var(--card-bg));
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(140deg, color-mix(in oklab, var(--border-color) 24%, transparent), transparent);
    opacity: 0;
    transition: opacity 160ms ease;
}

.metric-card:hover,
.quick-action-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent-color) 35%, var(--border-color));
    box-shadow: var(--shadow-card-soft-hover);
}

.metric-card:hover::after {
    opacity: 1;
}

.metric-card:focus-visible,
.quick-action-card:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.metric-body {
    display: grid;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--text-color-inverse, #ffffff);
    position: relative;
    z-index: 1;
    box-shadow: 0 12px 26px color-mix(in oklab, var(--accent-color) 18%, transparent);
}

.metric-blue .metric-icon {
    background: var(--primary-color, #2563eb);
}

.metric-green .metric-icon {
    background: var(--success, #10b981);
}

.metric-amber .metric-icon {
    background: var(--warning, #f59e0b);
}

.metric-red .metric-icon {
    background: var(--danger, #ef4444);
}

.metric-purple .metric-icon {
    background: linear-gradient(145deg, #a855f7, #ec4899);
}

.metric-label {
    align-self: center;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.18;
}

.metric-value {
    grid-column: 1 / -1;
    color: var(--text-color);
    font-size: clamp(30px, 16cqw, 42px);
    font-weight: 800;
    line-height: .96;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.metric-card.metric-primary {
    min-height: 138px;
    border-width: 2px;
    box-shadow: 0 16px 28px color-mix(in oklab, var(--accent-color) 12%, transparent);
}

.metric-card.metric-secondary {
    min-height: 130px;
    border-color: color-mix(in oklab, var(--border-color) 84%, transparent);
    background:
        linear-gradient(145deg, color-mix(in oklab, var(--card-bg) 94%, var(--surface-muted)), var(--card-bg));
}

.metric-card.metric-primary .metric-icon,
.metric-card.metric-secondary .metric-icon {
    box-shadow: 0 10px 24px color-mix(in oklab, var(--accent-color) 16%, transparent);
}

.metric-card.metric-primary .metric-icon {
    width: 48px;
    height: 48px;
}

.metric-card.metric-secondary .metric-icon {
    width: 44px;
    height: 44px;
}

.metric-card.metric-primary .metric-value {
    font-size: 34px;
}

.metric-card.metric-secondary .metric-value {
    font-size: 30px;
}

.metric-birthday {
    background: linear-gradient(145deg, color-mix(in oklab, #fdf2ff 72%, var(--card-bg)), color-mix(in oklab, #f5f3ff 34%, var(--card-bg)));
}

.metric-birthday .metric-icon {
    box-shadow: 0 12px 24px color-mix(in oklab, #a855f7 24%, transparent);
}

body[data-theme="light"] .dashboard-header,
body[data-theme="light"] .dashboard-panel,
body[data-theme="light"] .insight-strip,
body[data-theme="light"] .metric-card {
    border-color: color-mix(in oklab, var(--border-color-strong, #c6d4e6) 72%, transparent);
    box-shadow: 0 10px 26px color-mix(in oklab, #0f172a 8%, transparent);
}

body[data-theme="light"] .metric-card:hover,
body[data-theme="light"] .quick-action-card:hover,
body[data-theme="light"] .metric-card:focus-visible {
    border-color: color-mix(in oklab, var(--accent-color, #2563eb) 38%, var(--border-color-strong, #c6d4e6));
    box-shadow: 0 12px 26px color-mix(in oklab, var(--accent-color, #2563eb) 20%, transparent);
}

.metric-help {
    grid-column: 1 / -1;
    margin-top: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.28;
}

.dashboard-main-grid,
.dashboard-bottom-grid {
    display: grid;
    gap: 16px;
}

.dashboard-activity-panel {
    display: grid;
    gap: 16px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.dashboard-activity-header {
    align-items: center;
}

.dashboard-quick-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-quick-actions [hidden] {
    display: none !important;
}

.dashboard-activity-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
    gap: 16px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.activity-table-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: grid;
    align-content: start;
    gap: 10px;
    overflow: hidden;
}

.activity-table-title {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.activity-table-title strong {
    color: var(--text-color);
    font-size: 14px;
    font-weight: 800;
}

.activity-table-title button {
    flex: 0 0 auto;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--accent-color);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.activity-table-title button:hover {
    text-decoration: underline;
}

.dashboard-compact-table {
    box-shadow: none;
}

.dashboard-compact-table table {
    font-size: 12px;
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.dashboard-compact-table th,
.dashboard-compact-table td {
    padding: 9px 10px;
    white-space: nowrap;
}

.dashboard-compact-table td:last-child {
    white-space: normal;
}

.dashboard-main-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
    align-items: stretch;
}

.dashboard-main-grid > .dashboard-panel {
    height: clamp(450px, 54vh, 590px);
}

.dashboard-bottom-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, .8fr) minmax(280px, .8fr);
}

.dashboard-panel {
    min-width: 0;
    padding: 20px;
}

.trend-panel {
    display: flex;
    flex-direction: column;
}

.status-panel {
    display: flex;
    flex-direction: column;
}

.subscription-widget {
    border-color: color-mix(in oklab, var(--accent-color, #2563eb) 40%, transparent);
    padding: 18px;
}

.subscription-widget .panel-header {
    margin-bottom: 12px;
}

.subscription-widget-subtitle {
    margin-top: 4px;
}

.subscription-widget[data-state="warning"] {
    border-color: var(--warning, #f59e0b);
}

.subscription-widget[data-state="urgent"],
.subscription-widget[data-state="expired"] {
    border-color: var(--danger, #ef4444);
}

.subscription-widget[data-state="expired"] .subscription-status-pill,
.subscription-widget[data-state="urgent"] .subscription-status-pill {
    border-color: color-mix(in oklab, var(--danger, #ef4444) 34%, transparent);
    background: color-mix(in oklab, var(--danger, #ef4444) 15%, transparent);
    color: color-mix(in oklab, var(--danger, #ef4444) 88%, var(--text-color));
}

.subscription-widget[data-state="warning"] .subscription-status-pill {
    border-color: color-mix(in oklab, var(--warning, #f59e0b) 32%, transparent);
    background: color-mix(in oklab, var(--warning, #f59e0b) 14%, transparent);
    color: color-mix(in oklab, var(--warning, #f59e0b) 82%, var(--text-color));
}

.subscription-widget-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.subscription-metric {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
    padding: 12px;
    display: grid;
    gap: 2px;
}

.subscription-widget .subscription-metric strong,
.subscription-widget .subscription-metric small {
    display: block;
}

.subscription-widget-grid small {
    margin-top: 4px;
    color: var(--text-muted);
    font-weight: 700;
}

.subscription-widget-meta {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}

.subscription-status-pill {
    border: 1px solid color-mix(in oklab, var(--accent-color, #2563eb) 28%, transparent);
    border-radius: 999px;
    min-height: 30px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in oklab, var(--accent-color, #2563eb) 10%, transparent);
    color: var(--accent-color);
    font-weight: 800;
    font-size: 12px;
}

.subscription-status-pill,
.subscription-usage {
    margin-top: 8px;
    display: grid;
    gap: 7px;
    font-size: 12px;
}

.subscription-progress-label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.subscription-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.subscription-progress-bar {
    height: 100%;
    width: 0%;
    min-width: 8px;
    display: block;
    border-radius: 999px;
    transition: width 220ms ease;
    background: linear-gradient(90deg, var(--accent-color, #2563eb), var(--success, #10b981));
}

.subscription-widget.subscription-usage-unknown .subscription-progress-bar {
    background: linear-gradient(90deg, var(--accent-color, #2563eb), var(--accent-color, #2563eb));
}

#subscriptionUsageText {
    display: block;
    color: var(--text-color);
    font-size: 12px;
    font-weight: 700;
}

#subscriptionUsageBar {
    will-change: width;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-header h2 {
    margin: 0 0 4px;
    color: var(--text-color);
    font-size: 18px;
}

.trend-chart {
    flex: 1;
    min-height: 400px;
    display: grid;
    grid-template-columns: repeat(7, minmax(36px, 1fr));
    align-items: end;
    gap: 10px;
}

.trend-bar {
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    align-items: stretch;
}

.trend-bar-fill {
    flex: 0 0 auto;
    min-height: 10px;
    border-radius: 8px 8px 2px 2px;
    background: linear-gradient(180deg, color-mix(in oklab, var(--accent-color, #2563eb) 24%, transparent), var(--primary-color, #2563eb));
}

.trend-label,
.trend-value {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.trend-label {
    display: grid;
    gap: 2px;
}

.trend-label small {
    color: color-mix(in oklab, var(--text-muted) 72%, transparent);
    font-size: 10px;
    font-weight: 700;
}

.status-chart {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow: auto;
    padding-right: 8px;
    scrollbar-gutter: stable;
    display: grid;
    gap: 10px;
    align-content: start;
}

.status-group {
    margin-top: 4px;
    color: var(--accent-color);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.status-group:first-child {
    margin-top: 0;
}

.status-row {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin: -2px -4px;
    padding: 4px 4px;
    text-align: left;
}

button.status-row {
    cursor: pointer;
}

button.status-row:hover {
    background: color-mix(in oklab, var(--accent-color, #2563eb) 12%, transparent);
}

.status-row-header {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.status-chip {
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    min-width: 34px;
    text-align: center;
}

.status-chip-blue {
    background: color-mix(in oklab, var(--accent-color, #2563eb) 15%, transparent);
    color: var(--accent-color, #2563eb);
}

.status-chip-green {
    background: color-mix(in oklab, var(--success, #10b981) 15%, transparent);
    color: var(--success, #10b981);
}

.status-chip-amber {
    background: color-mix(in oklab, var(--warning, #f59e0b) 15%, transparent);
    color: var(--warning, #f59e0b);
}

.status-chip-red {
    background: color-mix(in oklab, var(--danger, #ef4444) 15%, transparent);
    color: var(--danger, #ef4444);
}

.status-chip-purple {
    background: color-mix(in oklab, #a855f7 15%, transparent);
    color: #a855f7;
}

.status-row:hover .status-track {
    filter: brightness(1.02);
}

button.status-row:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

.status-name {
    min-width: 0;
    color: var(--text-color);
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-value {
    color: var(--text-muted);
    font-weight: 800;
}

.status-track {
    grid-column: 1 / -1;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-muted);
}

.status-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--primary-color, #2563eb);
}

.activity-list,
.late-list {
    display: grid;
    gap: 10px;
    max-height: min(58vh, 620px);
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.activity-list::-webkit-scrollbar,
.late-list::-webkit-scrollbar {
    width: 8px;
}

.activity-list::-webkit-scrollbar-thumb,
.late-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--border-color);
}

.activity-item,
.late-item,
.kpi-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item,
.late-item {
    border-bottom: 1px dashed color-mix(in oklab, var(--border-color) 40%, transparent);
}

.activity-body {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.platform-row-action {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.platform-row-action:hover,
.platform-watch-row:hover {
    border-radius: 8px;
    background: var(--surface-muted);
}

.platform-status-pill {
    min-width: 92px;
    justify-self: end;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
}

.status-active {
    background: color-mix(in oklab, var(--success, #10b981) 18%, transparent);
    color: var(--success, #10b981);
}

.status-trial {
    background: color-mix(in oklab, var(--warning, #f59e0b) 18%, transparent);
    color: var(--warning, #f59e0b);
}

.status-expiring {
    background: color-mix(in oklab, var(--warning, #f59e0b) 20%, transparent);
    color: color-mix(in oklab, var(--warning, #f59e0b) 82%, var(--text-color));
}

.status-expired {
    background: color-mix(in oklab, var(--danger, #ef4444) 18%, transparent);
    color: var(--danger, #ef4444);
}

.status-suspended,
.status-muted {
    background: var(--surface-muted);
    color: var(--text-muted);
}

.kpi-row {
    grid-template-columns: minmax(0, 1fr) minmax(120px, max-content);
    column-gap: 18px;
}

.kpi-row-attendance {
    grid-template-columns: 112px minmax(0, 1fr) minmax(104px, max-content);
    column-gap: 16px;
    align-items: center;
}

.activity-body,
.late-item-body {
    min-width: 0;
}

.activity-avatar,
.late-avatar {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(155deg, color-mix(in oklab, var(--accent-color, #2563eb) 60%, transparent), color-mix(in oklab, var(--accent-color, #2563eb) 18%, transparent));
    color: var(--text-color-inverse, #ffffff);
    font-size: 16px;
    font-weight: 800;
    flex: 0 0 auto;
}

.activity-avatar span,
.late-avatar span {
    line-height: 1;
    letter-spacing: 0;
    color: currentColor;
    text-transform: uppercase;
    font-size: 13px;
}

.activity-avatar {
    cursor: default;
    border: 1px solid color-mix(in srgb, var(--border-color) 62%, transparent);
}

button.activity-avatar {
    cursor: pointer;
}

.activity-avatar.has-image,
.late-avatar.has-image {
    background: var(--surface-muted);
    color: transparent;
}

.activity-avatar img,
.late-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.activity-checkin {
    background: color-mix(in oklab, var(--success, #10b981) 22%, transparent);
    color: var(--success, #10b981);
}

.activity-checkout {
    background: color-mix(in oklab, var(--danger, #ef4444) 22%, transparent);
    color: var(--danger, #ef4444);
}

.activity-lunchout {
    background: color-mix(in oklab, var(--accent-color, #2563eb) 22%, transparent);
    color: var(--accent-color, #2563eb);
}

.activity-lunchin {
    background: color-mix(in oklab, var(--warning, #f59e0b) 22%, transparent);
    color: var(--warning, #f59e0b);
}

.activity-status-icon {
    color: var(--text-muted);
}

.activity-time {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    font-weight: 700;
}

.activity-time[datetime] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.activity-time[datetime]::before {
    content: "\f017";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    opacity: .7;
}

.late-action {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    padding-block: 5px;
}

.late-action:hover {
    background: var(--surface-muted);
    border-radius: 8px;
    padding-inline: 12px;
}

.activity-item:last-child,
.late-item:last-child,
.kpi-row:last-child {
    border-bottom: 0;
}

.activity-title,
.late-name,
.kpi-name {
    color: var(--text-color);
    font-weight: 800;
}

.activity-title {
    font-weight: 600;
}

.late-minutes,
.kpi-time {
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 900;
    min-width: auto;
    padding-right: 4px;
    text-align: left;
    white-space: nowrap;
}

.kpi-time-primary {
    display: grid;
    justify-content: start;
    min-width: 0;
    padding-right: 0;
    text-align: left;
}

.kpi-time-primary strong {
    font-size: 15px;
    line-height: 1.1;
}

.kpi-status {
    justify-self: end;
    max-width: 190px;
    padding: 6px 10px;
    border-radius: 999px;
    background: color-mix(in oklab, var(--accent-color, #2563eb) 12%, transparent);
    color: var(--text-color);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-date-secondary {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.late-side {
    display: grid;
    gap: 6px;
    justify-items: end;
    align-content: center;
}

.late-inline-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.late-mini-btn {
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 5px 8px;
    min-height: 28px;
    color: var(--text-color);
    background: var(--surface-muted);
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    transition: transform .16s ease, filter .16s ease;
}

.late-mini-btn.approve {
    border-color: color-mix(in oklab, var(--success, #10b981) 35%, transparent);
    color: var(--success, #10b981);
    background: color-mix(in oklab, var(--success, #10b981) 18%, transparent);
}

.late-mini-btn.reject {
    border-color: color-mix(in oklab, var(--danger, #ef4444) 35%, transparent);
    color: var(--danger, #ef4444);
    background: color-mix(in oklab, var(--danger, #ef4444) 18%, transparent);
}

.late-mini-btn:hover {
    filter: brightness(1.12);
}

.kpi-time-label {
    display: block;
    color: var(--muted-text);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 2px;
}

.kpi-time strong {
    color: var(--accent-color);
    font-size: 13px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.superadmin-dashboard .quick-actions {
    grid-template-columns: 1fr;
}

.platform-watch-list {
    display: grid;
    gap: 8px;
}

.platform-watch-row {
    min-height: auto !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 12px !important;
    background: var(--surface-muted) !important;
    color: var(--text-color) !important;
}

.platform-watch-row span,
.platform-watch-row strong,
.platform-watch-row small {
    min-width: 0;
    display: block;
}

.platform-watch-row small {
    margin-top: 4px;
    color: var(--text-muted);
    font-weight: 800;
}

.platform-empty-watch {
    min-height: 104px;
    display: grid;
    place-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-color);
    text-align: center;
}

.platform-empty-watch i {
    color: var(--success, #10b981);
    font-size: 22px;
}

.platform-empty-watch span {
    color: var(--text-muted);
    font-weight: 400;
}

.platform-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.quick-actions button {
    min-height: 84px;
    flex-direction: column;
    align-items: flex-start;
    background: var(--surface-muted);
    color: var(--text-color);
    border: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
    border-radius: 14px;
    text-align: left;
    padding: 16px;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
    display: inline-flex;
    gap: 10px;
}

.quick-action-card {
    min-height: 84px;
    align-items: flex-start;
    background: var(--surface-muted);
    color: var(--text-color);
    border: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
    border-radius: 14px;
    text-align: left;
    padding: 16px;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
    display: inline-flex;
    gap: 10px;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.quick-actions button:hover,
.quick-action-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent-color) 35%, var(--border-color));
    box-shadow: var(--shadow-card-soft-hover);
}

.quick-action-card::after {
    content: "\f061";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 12px;
    bottom: 12px;
    font-size: 14px;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.quick-action-card:hover::after {
    opacity: 0.9;
    transform: translateX(0);
}

.quick-action-card:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    flex: 0 0 auto;
    background: color-mix(in oklab, var(--accent-color) 16%, transparent);
    color: var(--accent-color);
    font-size: 20px;
}

.quick-action-title {
    font-weight: 600;
    font-size: 0.97rem;
}

.quick-action-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
    font-weight: 400;
}

.quick-actions i {
    color: var(--accent-color);
    font-size: 22px;
}

.empty-state,
.error-state {
    min-height: 92px;
    display: grid;
    place-items: center;
    gap: 7px;
    padding: 18px;
    border: 1px dashed color-mix(in oklab, var(--border-color) 72%, transparent);
    border-radius: 14px;
    background:
        linear-gradient(145deg, color-mix(in oklab, var(--surface-muted) 82%, transparent), color-mix(in oklab, var(--card-bg) 96%, transparent));
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in oklab, var(--accent-color) 14%, transparent);
    color: var(--accent-color);
    font-size: 15px;
}

.empty-state strong {
    color: var(--text-color);
    font-size: 13px;
    line-height: 1.35;
}

.empty-state span,
.empty-state small {
    max-width: 280px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.error-state {
    color: var(--danger, #ef4444);
}

.dashboard-skeleton {
    width: 100%;
    height: 16px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--surface-muted), var(--border-color), var(--surface-muted));
    background-size: 200% 100%;
    animation: dashboard-pulse 1.1s linear infinite;
}

.kpi-dialog {
    width: min(860px, calc(100vw - 32px));
    max-height: calc(100dvh - 40px);
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    box-shadow: var(--shadow-card, 0 8px 26px rgba(15, 23, 42, .34));
    overflow: auto;
}

.kpi-dialog[open] {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.kpi-dialog::backdrop {
    background: color-mix(in oklab, var(--text-color) 30%, transparent);
}

.kpi-dialog-content {
    display: grid;
    gap: 16px;
    padding: 22px;
}

.kpi-dialog-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.kpi-dialog-header h2 {
    margin: 0 0 4px;
}

.icon-btn {
    width: 38px;
    height: 38px;
    background: var(--surface-muted);
    color: var(--text-color);
}

.kpi-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px 190px;
    gap: 12px;
}

.kpi-search {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text-muted);
}

.kpi-search input,
.kpi-tools select {
    width: 100%;
    min-width: 0;
    height: 42px;
    border: 0;
    outline: 0;
    background: var(--surface-muted);
    color: var(--text-color);
}

.kpi-tools select {
    border-radius: 8px;
    padding: 0 10px;
}

.kpi-list {
    max-height: min(58vh, 560px);
    overflow: auto;
    padding-right: 16px;
    scrollbar-gutter: stable;
}

.late-dialog {
    width: min(760px, calc(100vw - 32px));
}

.late-dialog-content {
    gap: 18px;
}

.late-dialog .kpi-dialog-header {
    grid-template-columns: auto 1fr auto;
    align-items: center;
}

.late-photo-button {
    width: 72px;
    height: 72px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--primary-color);
    color: var(--text-color-inverse, #ffffff);
    font-weight: 900;
    cursor: pointer;
}

.late-photo-button:disabled {
    cursor: default;
    opacity: .75;
}

.late-photo-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.late-photo-button span {
    font-size: 22px;
}

.late-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.late-detail {
    min-height: 92px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
}

.late-detail.wide {
    grid-column: span 3;
}

.late-detail span,
.late-pin-field span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.late-detail strong {
    color: var(--text-color);
    font-size: 20px;
    line-height: 1.2;
}

.late-approval-box {
    display: grid;
    gap: 12px;
}

.late-pin-field {
    display: grid;
    gap: 8px;
}

.late-pin-field input,
.late-pin-field textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: 0;
    background: var(--surface-muted);
    color: var(--text-color);
    font: inherit;
}

.late-pin-field input {
    min-height: 44px;
    padding: 0 12px;
}

.late-pin-field textarea {
    resize: vertical;
    min-height: 86px;
    padding: 12px;
}

.late-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.danger-action {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--danger, #ef4444);
    color: var(--text-color-inverse, #ffffff);
    font-weight: 600;
    cursor: pointer;
}

.primary-action:disabled,
.danger-action:disabled {
    cursor: wait;
    opacity: .7;
}

.late-dialog-message,
.late-processed-note {
    margin: 0;
    color: var(--text-muted);
    font-weight: 800;
}

.late-message-error {
    color: var(--danger, #ef4444);
}

.late-message-success {
    color: var(--success, #10b981);
}

.late-processed-note {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-muted);
}

.late-image-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    place-items: center;
    padding: 20px;
    background: color-mix(in oklab, var(--text-color) 58%, transparent);
}

.late-image-modal.active {
    display: grid;
}

.late-image-modal img {
    max-width: min(100%, 980px);
    max-height: 86vh;
    border: 1px solid color-mix(in oklab, var(--text-color-inverse) 22%, transparent);
    border-radius: 8px;
    box-shadow: var(--shadow-card, 0 8px 26px rgba(15, 23, 42, .34));
}

.late-image-close {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: color-mix(in oklab, var(--text-color) 72%, transparent);
    color: var(--text-color-inverse);
    cursor: pointer;
}

@keyframes dashboard-pulse {
    to {
        background-position: -200% 0;
    }
}

/* Premium dashboard visual refinements */
.dashboard-header {
    min-height: 142px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 14px;
    padding: 20px 26px;
    border-radius: 18px;
    border-width: 1px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    background: linear-gradient(132deg, color-mix(in oklab, var(--surface-muted, #f8fafc) 76%, transparent), var(--card-bg, #ffffff));
}

.dashboard-kicker {
    letter-spacing: .08em;
}

.dashboard-subtitle {
    max-width: 780px;
    color: var(--text-muted);
}

.dashboard-hero-meta {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.dashboard-hero-stat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    border: 1px solid color-mix(in oklab, var(--border-color) 76%, transparent);
    border-radius: 12px;
    padding: 7px 10px;
    background: var(--surface-muted);
}

.dashboard-hero-stat i {
    width: 14px;
    color: var(--accent-color);
    text-align: center;
}

.dashboard-hero-stat-body {
    display: grid;
    min-width: 0;
}

.dashboard-hero-stat-label {
    color: var(--text-subtle);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    line-height: 1;
}

.dashboard-hero-stat strong {
    color: var(--text-color);
    font-size: 12px;
    line-height: 1.25;
    font-weight: 600;
}

.activity-list,
.late-list,
.activity-item,
.late-item {
    gap: 14px;
}

.activity-meta {
    color: var(--text-subtle);
    font-size: 12px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.activity-time {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 1px;
}

.activity-avatar,
.late-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid color-mix(in oklab, var(--border-color) 68%, transparent);
}

.late-mini-btn {
    transition: transform .16s ease, filter .16s ease;
}

.late-mini-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.late-name,
.kpi-name,
.activity-title {
    font-weight: 600;
}

.quick-action-subtitle {
    color: var(--text-subtle);
}

.quick-action-icon {
    box-shadow: 0 8px 20px color-mix(in oklab, var(--accent-color) 22%, transparent);
}

.empty-state {
    border-style: dashed;
}

@media (max-width: 1180px) {
    .dashboard-bottom-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-activity-grid {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: clamp(30px, 16cqw, 36px);
    }
}

@media (max-width: 1040px) {
    .metric-grid,
    .employee-dashboard .metric-grid,
    .dashboard-main-grid,
    .dashboard-bottom-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-main-grid > .dashboard-panel {
        height: auto;
    }
}

@media (max-width: 700px) {
    .dashboard-header,
    .metric-grid,
    .employee-dashboard .metric-grid,
    .dashboard-main-grid,
    .dashboard-bottom-grid,
    .kpi-tools,
    .late-detail-grid,
    .late-dialog-actions {
        grid-template-columns: 1fr;
    }

    .late-detail.wide {
        grid-column: auto;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .late-dialog .kpi-dialog-header {
        grid-template-columns: auto 1fr auto;
    }

    .kpi-list {
        padding-right: 6px;
    }

    .kpi-row {
        grid-template-columns: 1fr;
        gap: 6px;
        align-items: start;
    }

    .kpi-row-attendance {
        grid-template-columns: minmax(86px, max-content) minmax(0, 1fr);
        column-gap: 12px;
        row-gap: 6px;
    }

    .kpi-row-attendance .kpi-status {
        grid-column: 2;
        justify-self: start;
        max-width: 100%;
    }

    .kpi-time {
        min-width: 0;
        padding-right: 0;
        text-align: left;
    }

    .dashboard-header {
        padding: 22px;
    }

    .dashboard-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .dashboard-period-filter,
    .dashboard-custom-range,
    .dashboard-period-filter select,
    .dashboard-custom-range input {
        width: 100%;
    }

    .dashboard-custom-range {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-quick-actions {
        justify-content: stretch;
    }

    .dashboard-quick-actions > * {
        flex: 1 1 180px;
    }

    .metric-card {
        min-height: 104px;
        padding: 14px;
        gap: 12px;
    }

    .metric-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .metric-value {
        font-size: clamp(26px, 14cqw, 30px);
    }

    .dashboard-actions > * {
        flex: 1;
    }

    .dashboard-header h1 {
        font-size: 28px;
    }

    .trend-chart {
        min-height: 280px;
        overflow-x: auto;
    }
}

/* Revenue dashboard production refinements */
.dashboard-page.is-loading {
    cursor: progress;
}

.dashboard-page.is-loading .dashboard-panel,
.dashboard-page.is-loading .metric-card {
    pointer-events: none;
}

.dashboard-main-grid > .dashboard-panel {
    height: auto;
    min-height: 188px;
}

.trend-panel {
    min-height: 188px;
}

.dashboard-mini-bars {
    display: grid;
    gap: 10px;
    align-content: start;
}

.dashboard-mini-bar {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.dashboard-mini-bar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-color);
    font-size: 12px;
    font-weight: 600;
}

.dashboard-mini-bar-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-mini-bar-row strong {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 800;
}

.dashboard-mini-bars .progress {
    height: 7px;
    border-radius: 999px;
    background: var(--surface-muted);
    overflow: hidden;
}

.dashboard-mini-bars .progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--primary-color, #2563eb);
}

.dashboard-empty-state {
    min-height: 112px;
    padding: 16px;
}

.trend-panel .dashboard-empty-state {
    min-height: 104px;
}

.dashboard-activity-table-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    contain: inline-size;
    max-height: 342px;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--card-bg);
    scrollbar-gutter: stable;
}

.dashboard-compact-table table {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
}

.dashboard-table-scroll-hint {
    display: none;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    color: var(--text-subtle);
    font-size: 11px;
    font-weight: 800;
}

.dashboard-table-scroll-hint[hidden] {
    display: none !important;
}

.dashboard-compact-table th,
.dashboard-compact-table td {
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
}

.dashboard-compact-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 800;
}

.dashboard-compact-table tbody tr:hover td {
    background: var(--surface-hover);
}

.dashboard-compact-table tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--surface-muted);
    color: var(--text-color);
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    border-top: 1px solid var(--border-color);
    border-bottom: 0;
}

.dashboard-loading-card {
    cursor: wait;
}

.dashboard-loading-card .dashboard-skeleton {
    position: relative;
    z-index: 1;
}

.dashboard-skeleton {
    display: block;
    width: 100%;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg,
        color-mix(in oklab, var(--surface-muted) 86%, transparent),
        color-mix(in oklab, var(--border-color) 76%, transparent),
        color-mix(in oklab, var(--surface-muted) 86%, transparent));
    background-size: 220% 100%;
    animation: dashboard-pulse 1.05s linear infinite;
}

.skeleton-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
}

.skeleton-line {
    max-width: 70%;
}

.skeleton-value {
    grid-column: 1 / -1;
    height: 34px;
    max-width: 82%;
}

.skeleton-help {
    grid-column: 1 / -1;
    height: 12px;
    max-width: 64%;
}

.skeleton-bar {
    height: 8px;
}

.skeleton-cell {
    height: 12px;
    min-width: 74px;
}

.icon-text-btn:disabled,
.primary-action:disabled {
    cursor: wait;
    opacity: .72;
}

.icon-text-btn.is-loading i {
    color: var(--accent-color);
}

.dashboard-actions {
    column-gap: 12px;
    row-gap: 10px;
}

.dashboard-period-filter {
    padding: 4px;
    border: 1px solid color-mix(in oklab, var(--border-color) 72%, transparent);
    border-radius: 14px;
    background: color-mix(in oklab, var(--surface-muted) 78%, transparent);
}

.dashboard-period-filter select {
    min-width: 154px;
}

.dashboard-today-shortcut[hidden] {
    display: none !important;
}

@media (min-width: 1280px) {
    .metric-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 1040px) {
    .dashboard-activity-table-wrap {
        max-height: 334px;
    }
}

@media (max-width: 700px) {
    .dashboard-panel,
    .dashboard-activity-panel,
    .dashboard-activity-grid,
    .activity-table-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .dashboard-panel {
        overflow: hidden;
    }

    .dashboard-main-grid > .dashboard-panel,
    .trend-panel {
        min-height: 160px;
    }

    .dashboard-activity-table-wrap {
        max-height: 324px;
    }

    .dashboard-table-scroll-hint {
        display: inline-flex;
    }

    .dashboard-compact-table table {
        font-size: 11px;
    }

    .dashboard-compact-table th,
    .dashboard-compact-table td {
        padding: 7px 8px;
    }

    .dashboard-compact-table th:first-child,
    .dashboard-compact-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 3;
        min-width: 132px;
        max-width: 180px;
        white-space: normal;
        box-shadow: 8px 0 14px color-mix(in oklab, var(--page-bg) 44%, transparent);
    }

    .dashboard-compact-table thead th:first-child {
        z-index: 5;
    }

    .dashboard-compact-table tfoot td:first-child {
        z-index: 4;
    }
}
