/*
 * Maitre'D Portal — Component Library
 * All UI components, prefixed .mdp-
 */

/* ── BUTTONS ── */

.mdp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1.2;
}
.mdp-btn .material-symbols-rounded { font-size: 16px; }

.mdp-btn--primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,112,199,0.28);
}
.mdp-btn--primary:hover {
  opacity: 0.9;
  box-shadow: 0 4px 14px rgba(0,112,199,0.38);
  transform: translateY(-1px);
}
.mdp-btn--primary:active { transform: translateY(0); }

.mdp-btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.mdp-btn--secondary:hover { background: var(--color-primary-xlight); }

.mdp-btn--ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1.5px solid var(--color-border);
}
.mdp-btn--ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.mdp-btn--danger {
  background: var(--color-error);
  color: #fff;
}
.mdp-btn--danger:hover { background: var(--color-error-dark); }

.mdp-btn--icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}
.mdp-btn--icon:hover { background: var(--color-bg); color: var(--color-text); }

.mdp-btn--sm { padding: 5px var(--space-3); font-size: var(--text-xs); }
.mdp-btn--lg { padding: var(--space-3) var(--space-6); font-size: var(--text-base); }
.mdp-btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── BADGES ── */

.mdp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}
.mdp-badge--success { background: var(--color-success-bg);  color: var(--color-success-dark);  border: 1px solid var(--color-success-border); }
.mdp-badge--warning { background: var(--color-warning-bg);  color: var(--color-warning-dark);  border: 1px solid var(--color-warning-border); }
.mdp-badge--error   { background: var(--color-error-bg);    color: var(--color-error-dark);    border: 1px solid var(--color-error-border); }
.mdp-badge--info    { background: var(--color-info-bg);     color: var(--color-info-dark);     border: 1px solid var(--color-info-border); }
.mdp-badge--muted   { background: var(--color-bg-alt);      color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.mdp-badge--beta    { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.mdp-badge--primary { background: var(--color-primary-xlight); color: var(--color-primary-dark); border: 1px solid #bfdbfe; }

.mdp-badge__dot {
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.mdp-badge--success .mdp-badge__dot { background: var(--color-success); }
.mdp-badge--warning .mdp-badge__dot { background: var(--color-warning); }
.mdp-badge--error   .mdp-badge__dot { background: var(--color-error); }
.mdp-badge--muted   .mdp-badge__dot { background: var(--color-text-muted); }

/* ── CARDS ── */

.mdp-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}
.mdp-card--hover {
  cursor: pointer;
  transition: var(--transition);
}
.mdp-card--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
}
.mdp-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.mdp-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-text);
}
.mdp-card__subtitle {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ── KPI CARDS ── */

.mdp-kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  padding: var(--space-5) var(--space-6);
}
.mdp-kpi-card__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}
.mdp-kpi-card__value {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-3xl);
  color: var(--color-text);
  line-height: 1;
  margin-bottom: var(--space-2);
}
.mdp-kpi-card__trend {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
}
.mdp-kpi-card__trend--up     { color: var(--color-success-dark); }
.mdp-kpi-card__trend--down   { color: var(--color-error-dark); }
.mdp-kpi-card__trend--neutral{ color: var(--color-text-muted); }
.mdp-kpi-card__trend-label   { color: var(--color-text-muted); font-weight: 400; margin-left: 2px; }

/* ── MODULE TILES ── */

.mdp-module-tile {
  display: flex;
  background: linear-gradient(to bottom, var(--color-surface) 49%, var(--color-bg) 50%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  text-decoration: none;
}
.mdp-module-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(248,104,30,0.14);
  border-color: rgba(248,104,30,0.25);
}
.mdp-module-tile__icon-panel {
  flex-shrink: 0;
  width: 72px;
  background: var(--color-bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  border-top-right-radius: 32px;
}
.mdp-module-tile__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  flex-shrink: 0;
}
.mdp-module-tile__icon .material-symbols-rounded {
  font-size: 22px;
  color: #fff;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.mdp-module-tile__body {
  flex: 1;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-bottom-left-radius: 32px;
}
.mdp-module-tile__name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  color: var(--color-text);
  margin-bottom: 6px;
}
.mdp-module-tile__divider {
  width: 24px;
  height: 2px;
  background: #e0e0e0;
  border-radius: 2px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.mdp-module-tile__desc {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 12px;
}
.mdp-module-tile__btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s;
  pointer-events: none;
}
.mdp-module-tile:hover .mdp-module-tile__btn {
  background: var(--color-primary-dark);
}
.mdp-module-tile__btn .material-symbols-rounded { font-size: 14px; }

/* ── PORTAL CARDS ── */

.mdp-portal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  transition: var(--transition);
}
.mdp-portal-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.mdp-portal-card__icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}
.mdp-portal-card__icon .material-symbols-rounded { font-size: 28px; }
.mdp-portal-card__body  { flex: 1; min-width: 0; }
.mdp-portal-card__name  { font-family: var(--font-heading); font-weight: 600; font-size: var(--text-md); color: var(--color-text); margin-bottom: 3px; }
.mdp-portal-card__alias { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: var(--space-2); }
.mdp-portal-card__desc  { font-size: var(--text-sm); color: var(--color-text-secondary); line-height: 1.5; margin-bottom: var(--space-4); }
.mdp-portal-card__footer { display: flex; align-items: center; justify-content: space-between; }

/* ── INTEGRATION CARDS ── */

.mdp-integration-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: var(--transition);
  cursor: pointer;
}
.mdp-integration-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.mdp-integration-card__header { display: flex; align-items: center; gap: var(--space-3); }
.mdp-integration-card__logo {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.mdp-integration-card__name { font-family: var(--font-heading); font-weight: 600; font-size: var(--text-sm); color: var(--color-text); }
.mdp-integration-card__cat  { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }
.mdp-integration-card__desc { font-size: var(--text-xs); color: var(--color-text-secondary); line-height: 1.5; flex: 1; }
.mdp-integration-card__footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* ── FORMS ── */

.mdp-form-group { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }

.mdp-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mdp-input {
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface);
  transition: var(--transition-fast);
  outline: none;
  width: 100%;
  height: 38px;
}
.mdp-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-xlight); }
.mdp-input::placeholder { color: var(--color-text-muted); }

.mdp-input-group { position: relative; }
.mdp-input-group .mdp-input { padding-left: 36px; }
.mdp-input-group__icon {
  position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted); font-size: 16px; pointer-events: none;
}

.mdp-search { position: relative; }
.mdp-search .mdp-input { padding-left: 36px; }
.mdp-search__icon {
  position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted); font-size: 16px; pointer-events: none;
}

.mdp-select {
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background: var(--color-surface);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  height: 38px;
}
.mdp-select:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-xlight); }

/* ── FILTER / TOOLBAR ROWS ── */

.mdp-filter-row {
  display: flex; align-items: center;
  gap: var(--space-3); flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.mdp-filter-row .mdp-search { flex: 1; min-width: 180px; max-width: 300px; }

.mdp-table-toolbar {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3); flex-wrap: wrap;
}
.mdp-table-toolbar__left  { display: flex; align-items: center; gap: var(--space-3); flex: 1; flex-wrap: wrap; }
.mdp-table-toolbar__right { display: flex; align-items: center; gap: var(--space-3); }

/* ── TABLES ── */

.mdp-table-wrapper {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.mdp-table { width: 100%; border-collapse: collapse; }
.mdp-table th {
  background: var(--color-surface-raised);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.mdp-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.mdp-table tr:last-child td { border-bottom: none; }
.mdp-table tbody tr:hover { background: var(--color-surface-raised); }

.mdp-table__cell-user { display: flex; align-items: center; gap: var(--space-3); }
.mdp-table__avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11px; color: #fff; flex-shrink: 0;
}
.mdp-table__primary   { font-weight: 500; color: var(--color-text); }
.mdp-table__secondary { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 1px; }

.mdp-table__actions { display: flex; align-items: center; gap: var(--space-2); }

/* ── TAB BAR ── */

.mdp-tab-bar {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  scrollbar-width: none;
}
.mdp-tab-bar::-webkit-scrollbar { display: none; }
.mdp-tab-bar__item {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  user-select: none;
}
.mdp-tab-bar__item:hover { color: var(--color-text); }
.mdp-tab-bar__item.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}

/* ── ALERTS & BANNERS ── */

.mdp-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: var(--space-4);
}
.mdp-alert--info    { background: var(--color-info-bg);    color: var(--color-info-dark);    border: 1px solid var(--color-info-border); }
.mdp-alert--success { background: var(--color-success-bg); color: var(--color-success-dark); border: 1px solid var(--color-success-border); }
.mdp-alert--warning { background: var(--color-warning-bg); color: var(--color-warning-dark); border: 1px solid var(--color-warning-border); }
.mdp-alert--error   { background: var(--color-error-bg);   color: var(--color-error-dark);   border: 1px solid var(--color-error-border); }
.mdp-alert .material-symbols-rounded { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.mdp-alert strong { font-weight: 600; }

/* -- "NO REPORT CONTENT YET" MARKER (Reports Catalog tiles) -- */
/* Red dot beside a report name whose tile has neither a live embeddable nor a
   dedicated mockup page, so it still opens the generic report viewer. Driven
   by REPORT_PAGES + report.embeddable in the portal, so it disappears on its
   own once that report gets content. */
.mdp-todo-dot {
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--color-error, #dc2626);
  vertical-align: middle;
  flex-shrink: 0;
}

.mdp-global-banner {
  padding: 10px var(--space-8);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 999;
}
.mdp-global-banner--impersonation { background: #1e3a5f; color: #fff; }
.mdp-global-banner--consent { background: var(--color-warning-bg); color: var(--color-warning-dark); border-bottom: 1px solid var(--color-warning-border); }
.mdp-global-banner--dealer  { background: #1c2a1a; color: #86efac; border-bottom: 1px solid #166534; }
.mdp-global-banner .material-symbols-rounded { font-size: 18px; }
.mdp-global-banner__close { margin-left: auto; cursor: pointer; opacity: 0.7; }
.mdp-global-banner__close:hover { opacity: 1; }
.mdp-global-banner__link { text-decoration: underline; cursor: pointer; font-weight: 600; }

/* ── PAGINATION ── */

.mdp-pagination {
  display: flex; align-items: center;
  gap: var(--space-1); padding: var(--space-4);
  border-top: 1px solid var(--color-border);
}
.mdp-pagination__info { font-size: var(--text-xs); color: var(--color-text-muted); margin-right: auto; }
.mdp-pagination__btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: 500;
  cursor: pointer; transition: var(--transition-fast);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}
.mdp-pagination__btn:hover { background: var(--color-bg); color: var(--color-text); }
.mdp-pagination__btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.mdp-pagination__btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── EMPTY STATE ── */

.mdp-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center; gap: var(--space-3);
}
.mdp-empty__icon {
  width: 80px; height: 80px;
  border-radius: var(--radius-2xl);
  background: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted); margin-bottom: var(--space-2);
}
.mdp-empty__icon .material-symbols-rounded { font-size: 40px; }
.mdp-empty__title { font-family: var(--font-heading); font-weight: 600; font-size: var(--text-lg); color: var(--color-text); }
.mdp-empty__text  { font-size: var(--text-sm); color: var(--color-text-secondary); max-width: 360px; line-height: 1.6; }

/* ── CSS BAR CHARTS ── */

.mdp-chart-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-card);
}
.mdp-chart-title {
  font-family: var(--font-heading);
  font-weight: 600; font-size: var(--text-sm);
  color: var(--color-text); margin-bottom: var(--space-5);
}
/* Marks a mock chart block with its chart type. Was .mdp-sigma-badge in Sigma's own brand
   teal (#00CEAB), from when Sigma was the candidate BI vendor. Embeddable is the decision,
   so the badge is vendor-neutral and uses existing tokens rather than any vendor colour. */
.mdp-chart-badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600; font-family: var(--font-body);
  color: var(--color-text-muted); background: rgba(17,24,39,0.05);
  border: 1px solid rgba(17,24,39,0.10);
  border-radius: var(--radius-full);
  padding: 1px 6px; margin-left: var(--space-2);
  vertical-align: middle; letter-spacing: 0.02em;
}
.mdp-bar-chart {
  display: flex; align-items: flex-end;
  gap: var(--space-2); height: 130px;
  padding-bottom: var(--space-4);
}
.mdp-bar-chart__bar {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  gap: 4px; height: 100%;
}
.mdp-bar-chart__fill {
  width: 100%;
  background: var(--color-primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px; opacity: 0.8;
  transition: opacity 0.15s;
}
.mdp-bar-chart__fill:hover { opacity: 1; cursor: pointer; }
.mdp-bar-chart__fill--light { background: var(--color-primary-light); }
.mdp-bar-chart__label { font-size: 10px; color: var(--color-text-muted); text-align: center; white-space: nowrap; }

.mdp-hbar-chart { display: flex; flex-direction: column; gap: var(--space-3); }
.mdp-hbar-chart__row { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-xs); }
.mdp-hbar-chart__label { width: 80px; color: var(--color-text-secondary); flex-shrink: 0; }
.mdp-hbar-chart__track { flex: 1; height: 8px; background: var(--color-bg-alt); border-radius: var(--radius-full); overflow: hidden; }
.mdp-hbar-chart__fill  { height: 100%; border-radius: var(--radius-full); background: var(--color-primary); }
.mdp-hbar-chart__pct   { width: 36px; text-align: right; color: var(--color-text-muted); flex-shrink: 0; font-weight: 600; }

/* ── SECTION HEADERS ── */

.mdp-section-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap;
}
.mdp-section-header__title {
  font-family: var(--font-heading);
  font-weight: 700; font-size: var(--text-2xl);
  color: var(--color-text); margin-bottom: 4px;
}
.mdp-section-header__sub { font-size: var(--text-sm); color: var(--color-text-secondary); }
.mdp-section-header__actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; flex-shrink: 0; }

/* ── GRIDS ── */

.mdp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.mdp-kpi-grid--5 { grid-template-columns: repeat(5, 1fr); }
.mdp-kpi-grid--3 { grid-template-columns: repeat(3, 1fr); }
.mdp-kpi-grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .mdp-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .mdp-kpi-grid { grid-template-columns: 1fr; } }

.mdp-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (max-width: 1100px) { .mdp-tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .mdp-tile-grid { grid-template-columns: 1fr; } }

.mdp-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 900px) { .mdp-two-col { grid-template-columns: 1fr; } }

/* ── CATEGORY PILLS ── */

.mdp-pills { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-5); }
.mdp-pill {
  padding: 6px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600;
  cursor: pointer; transition: var(--transition-fast);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  user-select: none;
}
.mdp-pill:hover { border-color: var(--color-primary); color: var(--color-primary); }
.mdp-pill.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* Environment pills (DEV / UAT / PROD) sit directly under a section title, so
   they drop the category row's bottom margin and tighten up. */
.mdp-pills--env { margin: var(--space-2) 0 0; gap: var(--space-1); }
.mdp-pills--env .mdp-pill { padding: 3px var(--space-2); letter-spacing: .04em; }

/* ── SCOPE SWITCHER (sidebar) ── */

.mdp-scope-switcher {
  margin: 0 var(--space-3) var(--space-2);
  padding: var(--space-3);
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}
.mdp-scope-switcher:hover { background: rgba(255,255,255,0.10); }
.mdp-scope-switcher__label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.4); margin-bottom: 4px; }
.mdp-scope-switcher__value {
  font-size: var(--text-sm); font-weight: 600; color: rgba(255,255,255,0.9);
  display: flex; align-items: center; justify-content: space-between;
}
.mdp-scope-switcher__value .material-symbols-rounded { font-size: 16px; opacity: 0.6; }

/* ── WELCOME BANNER (dashboard) ── */

.mdp-welcome-banner {
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-8);
  color: #fff;
  margin-bottom: var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-4);
}
.mdp-welcome-banner__greeting { font-family: var(--font-heading); font-size: var(--text-2xl); font-weight: 700; margin-bottom: 4px; }
.mdp-welcome-banner__sub      { font-size: var(--text-sm); opacity: 0.85; }
.mdp-welcome-banner__right    { text-align: right; opacity: 0.85; font-size: var(--text-sm); line-height: 1.7; }

/* ── API KEY DISPLAY ── */

.mdp-key-value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 3px var(--space-2);
  color: var(--color-text-secondary);
  letter-spacing: 0.03em;
}

/* ── STATUS DOT ── */

.mdp-dot {
  width: 8px; height: 8px;
  border-radius: var(--radius-full);
  display: inline-block; flex-shrink: 0;
  vertical-align: middle;
}
.mdp-dot--green { background: var(--color-success); }
.mdp-dot--amber { background: var(--color-warning); }
.mdp-dot--red   { background: var(--color-error); }
.mdp-dot--gray  { background: var(--color-border-strong); }

/* ── SECTION TITLE ── */

.mdp-section-title {
  font-family: var(--font-heading);
  font-weight: 600; font-size: var(--text-md);
  color: var(--color-text); margin-bottom: var(--space-4);
  margin-top: var(--space-6);
}
.mdp-section-title:first-child { margin-top: 0; }

/* ── INTRO TEXT ── */

.mdp-intro-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-6);
  max-width: 680px;
}

/* ── FINANCE CARDS ── */

.mdp-finance-card {
  display: flex;
  background: linear-gradient(to bottom, var(--color-surface) 49%, var(--color-bg) 50%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  border: 1.5px solid transparent;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.mdp-finance-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(251,106,31,0.14);
  border-color: #FB6A1F;
}
.mdp-finance-card__icon-panel {
  flex-shrink: 0;
  width: 72px;
  background: var(--color-bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  border-top-right-radius: 32px;
}
/* v5.20.1 (UX feedback): no icon box — bare icon, grey at rest, orange on hover */
.mdp-finance-card__icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  flex-shrink: 0;
}
.mdp-finance-card__icon .material-symbols-rounded {
  font-size: 26px; color: #9aa1ab;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  transition: color 0.18s;
}
.mdp-finance-card:hover .mdp-finance-card__icon .material-symbols-rounded { color: #FB6A1F; }
.mdp-finance-card__body {
  flex: 1;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  background: #fff;
  border-bottom-left-radius: 32px;
}
.mdp-finance-card__header { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.mdp-finance-card__name  { font-family: var(--font-heading); font-weight: 700; font-size: 14px; color: var(--color-text); }
.mdp-finance-card__title { font-family: var(--font-heading); font-weight: 700; font-size: 14px; color: var(--color-text); }
.mdp-finance-card__divider {
  width: 24px; height: 2px; background: #e0e0e0;
  border-radius: 2px; flex-shrink: 0;
}
.mdp-finance-card__desc { font-size: 12px; color: var(--color-text-secondary); line-height: 1.5; flex: 1; }

/* ── DIVIDER ── */
.mdp-divider { border: none; border-top: 1px solid var(--color-border); margin: var(--space-6) 0; }

/* ── MISC ── */
.mdp-muted     { color: var(--color-text-muted); }
.mdp-secondary { color: var(--color-text-secondary); }
.text-mono     { font-family: var(--font-mono); font-size: var(--text-xs); }

/* ── LANGUAGE TOGGLE (topbar) ── */
.mdp-lang-toggle {
  display: flex;
  gap: 2px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.mdp-lang-toggle__btn {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-muted);
  transition: var(--transition-fast);
}
.mdp-lang-toggle__btn:hover:not(.active) { color: var(--color-text); }
.mdp-lang-toggle__btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-xs);
}

/* ── TOAST ── */
.mdp-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--color-text);
  color: var(--color-text-inverse);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}
.mdp-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── AI CHAT ──
   Floating "Ask My Maitre'D" button + inline panel removed by product
   decision (v5.56). All .mdp-ai-* rules that existed here (mdp-ai-chat,
   mdp-ai-panel*, mdp-ai-msg*) were used exclusively by that markup/JS —
   none are shared with #ask-modal (which uses the separate .mdp-ask-*
   and .ask-modal* classes) — so the whole block was deleted rather than
   kept dead. See SPEC.md §18.4. */

/* ── LIVE CHAT (Concierge Support) ── */

.mdp-chat-fab {
  position: fixed;
  bottom: 28px;
  /* right: 28px takes the corner — this used to be 92px (28 + the orange
     Ask My Maitre'D FAB's 52px width + a 12px gap) to sit beside that FAB.
     The orange FAB was removed in v5.56; do not restore this offset
     without also restoring that button. */
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  z-index: var(--z-modal);
  transition: var(--transition-fast);
}
.mdp-chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(37,99,235,0.45); }
.mdp-chat-fab .material-symbols-rounded { font-size: 24px; }
.mdp-chat-fab--online { background: #059669; }
.mdp-chat-fab--online:hover { box-shadow: 0 6px 20px rgba(5,150,105,0.45); }
.mdp-chat-fab--offline { background: #6b7280; opacity: 0.8; }
.mdp-chat-fab--offline:hover { box-shadow: 0 6px 20px rgba(107,114,128,0.45); }

.mdp-chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  z-index: calc(var(--z-modal) + 1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
.mdp-chat-panel--open { transform: translateX(0); }

.mdp-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.mdp-chat-panel__header-left { display: flex; align-items: center; gap: var(--space-3); }
.mdp-chat-panel__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(5,150,105,0.1);
  color: #059669;
}
.mdp-chat-panel__status--offline {
  background: rgba(107,114,128,0.1);
  color: #6b7280;
}
.mdp-chat-panel__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.mdp-chat-panel__title { font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.mdp-chat-panel__sub { font-size: 11px; color: var(--color-text-muted); margin-top: 1px; }
.mdp-chat-panel__close { background: transparent; border: none; cursor: pointer; color: var(--color-text-muted); display: flex; padding: 4px; border-radius: var(--radius-sm); }
.mdp-chat-panel__close:hover { background: var(--color-bg); color: var(--color-text); }

.mdp-chat-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mdp-chat-panel__footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-2);
}
.mdp-chat-panel__footer .mdp-input { flex: 1; }

.mdp-chat-msg { display: flex; gap: var(--space-3); align-items: flex-start; }
.mdp-chat-msg--specialist { flex-direction: row; }
.mdp-chat-msg--user { flex-direction: row-reverse; }
.mdp-chat-msg__icon { font-size: 20px; color: #2563eb; margin-top: 2px; flex-shrink: 0; }
.mdp-chat-msg__bubble {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  line-height: 1.6;
  max-width: 85%;
}
.mdp-chat-msg--user .mdp-chat-msg__bubble {
  background: #dbeafe;
  border-color: transparent;
  color: #1e40af;
  text-align: right;
}

/* ── TERMINAL CARDS (PAY Terminals) ── */

.mdp-terminal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-4);
}

.mdp-terminal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
}
.mdp-terminal-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
}

.mdp-terminal-card__image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  min-height: 180px;
  position: relative;
  overflow: hidden;
}
.mdp-terminal-card__image--a920    { background: linear-gradient(145deg, #1e3a5f, #2d5a8e); }
.mdp-terminal-card__image--a920pro { background: linear-gradient(145deg, #1a3a2a, #2d5a3d); }
.mdp-terminal-card__image--elys    { background: linear-gradient(145deg, #3a1e4a, #5d2d7a); }

.mdp-terminal-card__body {
  flex: 1;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.mdp-terminal-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.mdp-terminal-card__name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  color: var(--color-text);
}
.mdp-terminal-card__model {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.mdp-terminal-card__divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

.mdp-terminal-card__fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.mdp-terminal-card__field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
}
.mdp-terminal-card__field-label {
  color: var(--color-text-muted);
  font-weight: 500;
  flex-shrink: 0;
}
.mdp-terminal-card__field-value {
  color: var(--color-text-secondary);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  text-align: right;
}
.mdp-terminal-card__field-value--normal {
  font-family: var(--font-body);
  font-size: 12px;
}

.mdp-terminal-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

/* ── Location hierarchy view ─────────────────────────────────────────────── */
.hier-search { position: relative; margin-bottom: var(--space-5); }
.hier-search__input {
  width: 100%; padding: 11px 14px 11px 40px; font-size: 0.95rem;
  border: 1px solid #e2e8f0; border-radius: 10px; outline: none; box-sizing: border-box;
}
.hier-search__input:focus { border-color: #FB6A1F; }
.hier-search__icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: 20px; pointer-events: none;
}

.hier-divider {
  display: flex; align-items: center; gap: 10px;
  margin: var(--space-5) 0 var(--space-3); color: #94a3b8; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.hier-divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

.hier-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer;
}
.hier-row:hover { background: #f8fafc; }
.hier-row--static { cursor: default; }
.hier-row__main { flex: 1; min-width: 0; }
.hier-row__name { font-weight: 600; color: #0d1b2e; font-size: 0.9rem; }
.hier-row__sub { color: #64748b; font-size: 0.78rem; margin-top: 2px; }
.hier-row__path { color: #64748b; font-size: 0.78rem; }

.hier-type {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: #64748b; background: #f1f5f9; border-radius: 4px; padding: 2px 6px;
}

/* Validation state chips. Colours come from existing tokens, not new literals. */
.hier-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  white-space: nowrap;
}
.hier-chip--missing-id   { background: #fef2f2; color: var(--color-error); }
.hier-chip--unclassified { background: #f5f3ff; color: #6d28d9; }
.hier-chip--never        { background: #f1f5f9; color: #475569; }
.hier-chip--stale        { background: #fffbeb; color: #b45309; }
.hier-chip--validated    { background: #f0fdf4; color: #15803d; }

.hier-filter {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4);
}
.hier-filter__chip {
  font-size: 0.78rem; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid #e2e8f0; background: #fff; color: #475569; cursor: pointer;
}
.hier-filter__chip[aria-pressed="true"] {
  background: #0d1b2e; color: #fff; border-color: #0d1b2e;
}

.hier-actions {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-top: 1px solid #e2e8f0; margin-top: var(--space-3);
}
.hier-actions__count { color: #64748b; font-size: 0.82rem; }

.hier-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: var(--space-4); margin-bottom: var(--space-4);
}
.hier-card h3 {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: #64748b; margin: 0 0 var(--space-3);
}
.hier-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3);
}
.hier-field__label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8;
}
.hier-field__value { font-size: 0.9rem; color: #0d1b2e; margin-top: 2px; }
.hier-field__value--muted { color: #94a3b8; font-style: italic; }

.hier-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.hier-table th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: #94a3b8; padding: 6px 8px; border-bottom: 1px solid #e2e8f0; font-weight: 600;
}
.hier-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; color: #334155; }

.hier-empty { padding: var(--space-6); text-align: center; color: #94a3b8; font-size: 0.9rem; }

.hier-scroll { overflow-x: auto; }

/* ── Hierarchy add/edit modal ─────────────────────────────────────────────── */
.hier-modal {
  position: fixed; inset: 0; background: rgba(13,27,46,0.55);
  display: flex; align-items: center; justify-content: center; z-index: var(--z-modal);
  padding: var(--space-4);
}
.hier-modal__panel {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.hier-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4); border-bottom: 1px solid #e2e8f0;
}
.hier-modal__head h3 { margin: 0; font-size: 1rem; font-weight: 700; color: #0d1b2e; }
.hier-modal__close { background: none; border: 0; cursor: pointer; color: #64748b; }
.hier-modal__body { padding: var(--space-4); overflow-y: auto; }
.hier-modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: var(--space-4); border-top: 1px solid #e2e8f0;
}
.hier-modal__error {
  margin: 0 var(--space-4); padding: 8px 12px; border-radius: 8px;
  background: var(--color-error-bg, #fef2f2); color: var(--color-error);
  font-size: 0.82rem; font-weight: 600;
}
.hier-field { margin-bottom: var(--space-3); }
.hier-field label {
  display: block; font-size: 0.72rem; font-weight: 600; color: #475569;
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
}
.hier-field input, .hier-field select {
  width: 100%; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 0.9rem; box-sizing: border-box;
}
.hier-field input:focus, .hier-field select:focus { outline: none; border-color: #FB6A1F; }
.hier-field__req { color: var(--color-error); }
.hier-field__hint { font-size: 0.72rem; color: #94a3b8; margin-top: 3px; }
