/* MaiAgent Partner Portal — application styles */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: #F6F8FC;
  color: var(--mai-fg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: #FFFFFF;
  border-right: 1px solid var(--mai-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}
.sidebar__brand {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #EEF0F8;
}
.sidebar__brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--mai-navy-900);
  border-radius: 10px;
}
.sidebar__brand-mark svg { width: 24px; height: 24px; }
.sidebar__brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar__brand-name { font-weight: 700; font-size: 15px; color: var(--mai-fg); letter-spacing: -0.01em; }
.sidebar__brand-sub  { font-size: 11px; color: var(--mai-fg-3); font-weight: 500; letter-spacing: 0.04em; }

.sidebar__partner {
  margin: 14px;
  padding: 12px;
  background: #F4F6FF;
  border: 1px solid #E2E7F8;
  border-radius: 12px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar__partner-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #1F4FFF, #26C281);
  color: white; font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.sidebar__partner-info { min-width: 0; flex: 1; }
.sidebar__partner-name { font-weight: 600; font-size: 13px; color: var(--mai-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__partner-meta { font-size: 11px; color: var(--mai-fg-3); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.sidebar__partner-badge {
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(38,194,129,0.12); color: var(--mai-green-deep);
  letter-spacing: 0.04em;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar__section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--mai-fg-3); text-transform: uppercase;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500; font-size: 13.5px;
  color: var(--mai-fg-2);
  position: relative;
  transition: background 180ms cubic-bezier(0.2,0.8,0.2,1);
  user-select: none;
}
.nav-item:hover { background: #F4F6FF; color: var(--mai-fg); }
.nav-item.is-active {
  background: var(--mai-fg);
  color: white;
  font-weight: 600;
}
.nav-item.is-active .nav-item__icon { color: var(--mai-green-bright); }
.nav-item__icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--mai-fg-3); }
.nav-item:hover .nav-item__icon { color: var(--mai-fg-2); }
.nav-item__label { flex: 1; }
.nav-item__badge {
  font-size: 11px; font-weight: 700;
  background: var(--mai-green);
  color: white;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px; text-align: center;
}
.nav-item.is-active .nav-item__badge { background: var(--mai-green-bright); }

.sidebar__footer {
  padding: 12px 14px;
  border-top: 1px solid #EEF0F8;
  display: flex; align-items: center; gap: 8px;
  color: var(--mai-fg-3);
  font-size: 11.5px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--mai-border);
  display: flex; align-items: center;
  padding: 14px 28px;
  gap: 16px;
}
.topbar__crumbs { display: flex; align-items: center; gap: 8px; color: var(--mai-fg-3); font-size: 13px; font-weight: 500; }
.topbar__crumbs span.is-current { color: var(--mai-fg); font-weight: 600; }
.topbar__search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: #F4F6FF;
  border: 1px solid #E2E7F8;
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--mai-fg-3);
  margin-left: auto;
}
.topbar__search input {
  border: none; background: transparent; outline: none;
  flex: 1; font-size: 13px; color: var(--mai-fg); font-family: inherit;
}
.topbar__search kbd {
  font-family: inherit;
  font-size: 11px; font-weight: 600;
  padding: 2px 6px;
  background: white; border: 1px solid var(--mai-border);
  border-radius: 5px; color: var(--mai-fg-3);
}
.topbar__actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--mai-fg-2);
  position: relative;
  transition: background 180ms;
}
.icon-btn:hover { background: #F4F6FF; color: var(--mai-fg); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn__dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--mai-green);
  border: 2px solid white;
}

.lang-toggle {
  display: flex; align-items: center;
  border: 1px solid var(--mai-border);
  background: white;
  border-radius: 999px;
  padding: 2px;
  font-size: 11.5px; font-weight: 600;
  height: 32px;
}
.lang-toggle button {
  border: none; background: transparent;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--mai-fg-3);
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.lang-toggle button.is-active {
  background: var(--mai-fg);
  color: white;
}

/* ---------- Page area ---------- */
.page {
  padding: 28px 32px 48px;
  max-width: 1380px;
  margin: 0 auto;
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header__title { display: flex; flex-direction: column; gap: 6px; }
.page-header__eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--mai-fg-3); text-transform: uppercase;
}
.page-header h1 {
  margin: 0;
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--mai-fg);
}
.page-header__sub { color: var(--mai-fg-3); font-size: 14px; margin-top: 2px; }
.page-header__actions { display: flex; gap: 10px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600; font-size: 13px;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.2,0.8,0.2,1);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--mai-green); color: white; }
.btn--primary:hover { background: var(--mai-green-bright); box-shadow: var(--shadow-glow-green); }
.btn--primary:active { background: var(--mai-green-deep); transform: translateY(1px); box-shadow: none; }
.btn--dark { background: var(--mai-fg); color: white; }
.btn--dark:hover { background: var(--mai-navy-800); }
.btn--ghost { background: transparent; color: var(--mai-fg-2); border-color: var(--mai-border); background: white; }
.btn--ghost:hover { background: #F4F6FF; border-color: #C7D0EA; }
.btn--subtle { background: #F4F6FF; color: var(--mai-fg); }
.btn--subtle:hover { background: #E6EAFF; }
.btn--sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn--icon { padding: 9px; }
.btn--icon.btn--sm { padding: 6px; }

/* ---------- Cards ---------- */
.card {
  background: white;
  border: 1px solid var(--mai-border);
  border-radius: 16px;
  padding: 20px;
}
.card--lift { transition: transform 200ms cubic-bezier(0.2,0.8,0.2,1), box-shadow 200ms; }
.card--lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--mai-fg); }
.card-sub { font-size: 12px; color: var(--mai-fg-3); margin-top: 2px; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.kpi {
  background: white;
  border: 1px solid var(--mai-border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  overflow: hidden;
}
.kpi__label {
  font-size: 12px; font-weight: 600;
  color: var(--mai-fg-3);
  display: flex; align-items: center; gap: 6px;
}
.kpi__label svg { width: 14px; height: 14px; }
.kpi__value {
  font-size: 30px; font-weight: 700;
  color: var(--mai-fg);
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
  line-height: 1;
}
.kpi__value .kpi__unit { font-size: 16px; font-weight: 600; color: var(--mai-fg-3); margin-left: 4px; }
.kpi__delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  color: var(--mai-green-deep);
}
.kpi__delta.is-down { color: var(--mai-danger); }
.kpi__delta svg { width: 12px; height: 12px; }
.kpi__sub { color: var(--mai-fg-3); font-size: 12px; }
.kpi--accent { background: linear-gradient(135deg, #131838 0%, #1B2150 100%); color: white; border-color: transparent; }
.kpi--accent .kpi__label, .kpi--accent .kpi__sub { color: var(--mai-fg-on-dark-2); }
.kpi--accent .kpi__value { color: white; }
.kpi--accent .kpi__deco {
  position: absolute; right: -20px; top: -20px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(38,194,129,0.35) 0%, transparent 70%);
  pointer-events: none;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.02em;
  background: #F1F3FA;
  color: var(--mai-fg-2);
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge--green { background: rgba(38,194,129,0.12); color: var(--mai-green-deep); }
.badge--blue  { background: rgba(31,79,255,0.10); color: var(--mai-blue); }
.badge--amber { background: rgba(245,158,11,0.14); color: #B45309; }
.badge--red   { background: rgba(239,68,68,0.12); color: #B91C1C; }
.badge--violet{ background: rgba(99,102,241,0.14); color: #4338CA; }
.badge--gray  { background: #F1F3FA; color: var(--mai-fg-2); }
.badge__dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge--lg { padding: 5px 12px; font-size: 12px; }

/* ---------- Table ---------- */
.table-wrap {
  background: white;
  border: 1px solid var(--mai-border);
  border-radius: 16px;
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #EEF0F8;
  flex-wrap: wrap;
}
.table-toolbar__filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: transparent;
  color: var(--mai-fg-2);
  cursor: pointer;
  border: 1px solid transparent;
}
.filter-chip:hover { background: #F4F6FF; }
.filter-chip.is-active {
  background: var(--mai-fg);
  color: white;
}
.filter-chip__count {
  margin-left: 6px; font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 999px;
  background: rgba(255,255,255,0.18);
}
.filter-chip:not(.is-active) .filter-chip__count {
  background: #E6EAFF; color: var(--mai-fg-3);
}
.table-search {
  display: flex; align-items: center; gap: 6px;
  background: #F4F6FF;
  border: 1px solid #E2E7F8;
  border-radius: 8px;
  padding: 6px 10px;
  margin-left: auto;
}
.table-search input { border: none; background: transparent; outline: none; font-size: 13px; font-family: inherit; width: 180px; }
.table-search svg { width: 14px; height: 14px; color: var(--mai-fg-3); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data thead th {
  text-align: left;
  padding: 10px 18px;
  font-weight: 600; font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mai-fg-3);
  background: #FAFBFE;
  border-bottom: 1px solid #EEF0F8;
}
table.data tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid #F1F3FA;
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 150ms; cursor: pointer; }
table.data tbody tr:hover { background: #FAFBFE; }
table.data tbody tr.is-selected { background: #F4F6FF; }
.row-customer { display: flex; flex-direction: column; gap: 2px; }
.row-customer__name { font-weight: 600; color: var(--mai-fg); }
.row-customer__meta { font-size: 11.5px; color: var(--mai-fg-3); }
.row-amount { font-weight: 700; color: var(--mai-fg); font-variant-numeric: tabular-nums; }
.row-amount__sub { font-size: 11px; color: var(--mai-fg-3); font-weight: 500; }
.row-owner { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
  color: white;
  flex-shrink: 0;
}
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.avatar--lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Stepper / status ---------- */
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper__step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  color: var(--mai-fg-3);
}
.stepper__dot {
  width: 22px; height: 22px; border-radius: 999px;
  background: #F1F3FA; color: var(--mai-fg-3);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #E2E7F8;
}
.stepper__step.is-done .stepper__dot {
  background: var(--mai-green); color: white;
  box-shadow: 0 0 0 1px var(--mai-green);
}
.stepper__step.is-current .stepper__dot {
  background: var(--mai-fg); color: white;
  box-shadow: 0 0 0 1px var(--mai-fg), 0 0 0 4px rgba(14,18,48,0.08);
}
.stepper__step.is-done { color: var(--mai-fg-2); }
.stepper__step.is-current { color: var(--mai-fg); }
.stepper__bar {
  flex: 1; height: 2px;
  background: #E2E7F8;
  border-radius: 2px;
  min-width: 24px;
}
.stepper__bar.is-done { background: var(--mai-green); }

/* ---------- Dashboard layout ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.section-stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #F1F3FA;
}
.list-item:last-child { border-bottom: none; }
.list-item__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #F4F6FF;
  color: var(--mai-blue);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.list-item__icon svg { width: 16px; height: 16px; }
.list-item__icon--green { background: rgba(38,194,129,0.12); color: var(--mai-green-deep); }
.list-item__icon--amber { background: rgba(245,158,11,0.14); color: #B45309; }
.list-item__icon--violet { background: rgba(99,102,241,0.14); color: #4338CA; }
.list-item__icon--dark   { background: var(--mai-fg); color: var(--mai-green-bright); }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 600; color: var(--mai-fg); font-size: 13.5px; line-height: 1.35; }
.list-item__meta { font-size: 11.5px; color: var(--mai-fg-3); margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-item__action { flex-shrink: 0; }

/* ---------- Material/Resource Cards ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.tile {
  background: white;
  border: 1px solid var(--mai-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.2,0.8,0.2,1), box-shadow 200ms;
  display: flex; flex-direction: column;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile__cover {
  aspect-ratio: 4/3;
  background: var(--mai-bg-soft);
  position: relative;
  overflow: hidden;
}
.tile__type {
  position: absolute; top: 10px; left: 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: white;
  color: var(--mai-fg);
}
.tile__body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile__title { font-weight: 700; color: var(--mai-fg); line-height: 1.35; font-size: 14px; }
.tile__meta { font-size: 11.5px; color: var(--mai-fg-3); margin-top: auto; display: flex; align-items: center; gap: 8px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.form-grid--single { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field label {
  font-size: 12px; font-weight: 600; color: var(--mai-fg-2);
  display: flex; align-items: center; gap: 4px;
}
.field label .required { color: var(--mai-danger); }
.input, .textarea, .select {
  border: 1px solid var(--mai-border);
  background: white;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px; font-family: inherit;
  color: var(--mai-fg);
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--mai-blue);
  box-shadow: 0 0 0 3px rgba(31,79,255,0.12);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
.field__hint { font-size: 11.5px; color: var(--mai-fg-3); }

.radio-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill {
  border: 1px solid var(--mai-border);
  background: white;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  color: var(--mai-fg-2);
}
.radio-pill.is-active {
  background: var(--mai-fg);
  color: white;
  border-color: var(--mai-fg);
}

/* ---------- Modal / drawer ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(14,18,48,0.45);
  backdrop-filter: blur(6px);
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  animation: fadeIn 180ms cubic-bezier(0.2,0.8,0.2,1);
}
.drawer {
  width: min(720px, 100vw);
  background: white;
  height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: slideIn 240ms cubic-bezier(0.2,0.8,0.2,1);
}
.drawer__header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--mai-border);
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  position: sticky; top: 0; background: white; z-index: 2;
}
.drawer__title { font-size: 20px; font-weight: 700; color: var(--mai-fg); letter-spacing: -0.01em; }
.drawer__sub { color: var(--mai-fg-3); font-size: 13px; margin-top: 4px; }
.drawer__body { flex: 1; padding: 24px; }
.drawer__footer {
  position: sticky; bottom: 0; background: white;
  padding: 16px 24px;
  border-top: 1px solid var(--mai-border);
  display: flex; gap: 10px; justify-content: flex-end;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---------- Detail panel ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 24px;
}
.detail-grid__field { display: flex; flex-direction: column; gap: 4px; }
.detail-grid__label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mai-fg-3); }
.detail-grid__value { font-size: 13.5px; color: var(--mai-fg); font-weight: 500; }

/* ---------- Activity timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 14px; position: relative; padding-left: 28px; }
.timeline::before {
  content: ''; position: absolute; left: 11px; top: 8px; bottom: 8px;
  width: 2px; background: #E2E7F8;
}
.timeline__item { position: relative; }
.timeline__dot {
  position: absolute; left: -28px; top: 2px;
  width: 24px; height: 24px;
  border-radius: 999px;
  background: white;
  border: 2px solid var(--mai-border);
  display: grid; place-items: center;
  color: var(--mai-fg-3);
}
.timeline__dot svg { width: 12px; height: 12px; }
.timeline__dot--green { background: var(--mai-green); border-color: var(--mai-green); color: white; }
.timeline__dot--blue  { background: var(--mai-blue); border-color: var(--mai-blue); color: white; }
.timeline__dot--dark  { background: var(--mai-fg); border-color: var(--mai-fg); color: white; }
.timeline__title { font-weight: 600; font-size: 13.5px; color: var(--mai-fg); }
.timeline__meta  { font-size: 11.5px; color: var(--mai-fg-3); margin-top: 2px; }
.timeline__body  { font-size: 13px; color: var(--mai-fg-2); margin-top: 6px; padding: 10px 12px; background: #FAFBFE; border-radius: 10px; border: 1px solid #F1F3FA; }

/* ---------- Progress ---------- */
.progress {
  height: 6px;
  background: #F1F3FA;
  border-radius: 999px;
  overflow: hidden;
}
.progress__bar { height: 100%; background: var(--mai-green); border-radius: 999px; }
.progress__bar--blue { background: var(--mai-blue); }
.progress__bar--gradient { background: var(--grad-why); }

/* ---------- Bar chart (commission) ---------- */
.bars {
  display: flex; align-items: flex-end; gap: 10px;
  height: 180px;
  padding: 16px 0;
}
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars__bar {
  width: 100%;
  background: linear-gradient(180deg, var(--mai-blue) 0%, var(--mai-green) 100%);
  border-radius: 6px 6px 0 0;
  position: relative;
  min-height: 4px;
}
.bars__bar--muted { background: #E2E7F8; }
.bars__label { font-size: 11px; color: var(--mai-fg-3); font-weight: 600; }
.bars__value { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 700; color: var(--mai-fg); white-space: nowrap; }

/* ---------- Section split ---------- */
.split-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.split-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--mai-fg-3);
}
.empty svg { width: 32px; height: 32px; opacity: 0.4; margin-bottom: 8px; }

/* ---------- Hero banner ---------- */
.hero-card {
  background: linear-gradient(120deg, #131838 0%, #1B2150 55%, #1F4FFF 130%);
  color: white;
  border-radius: 20px;
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}
.hero-card__bg {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 50%;
  background-image:
    radial-gradient(circle at 30% 50%, rgba(38,194,129,0.4) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(99,102,241,0.5) 0%, transparent 50%);
  pointer-events: none;
}
.hero-card__halftone {
  position: absolute; right: -30px; top: -30px; width: 220px; height: 220px;
  background-image: radial-gradient(rgba(255,255,255,0.12) 1.5px, transparent 1.5px);
  background-size: 12px 12px;
  mask-image: radial-gradient(circle at 100% 0%, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 100% 0%, black 0%, transparent 70%);
  pointer-events: none;
}
.hero-card__content { position: relative; z-index: 1; max-width: 60%; }
.hero-card__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mai-green-bright); margin-bottom: 6px; }
.hero-card h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; }
.hero-card p { margin: 8px 0 0; color: var(--mai-fg-on-dark-2); font-size: 14px; }
.hero-card__cta { position: relative; z-index: 1; display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Toggle / switch ---------- */
.switch {
  width: 36px; height: 20px;
  background: #E2E7F8;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 180ms;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform 180ms cubic-bezier(0.2,0.8,0.2,1);
}
.switch.is-on { background: var(--mai-green); }
.switch.is-on::after { transform: translateX(16px); }

/* ---------- Mobile menu button ---------- */
.mobile-menu-btn { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .split-3 { grid-template-columns: 1fr; }
  .split-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.2,0.8,0.2,1);
    box-shadow: var(--shadow-lg);
    width: 280px;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(14,18,48,0.45);
    z-index: 25;
    animation: fadeIn 180ms;
  }
  .mobile-menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .topbar__search { display: none; }
  .topbar__crumbs { font-size: 12px; }
  .page { padding: 18px 16px 36px; }
  .page-header h1 { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  table.data { font-size: 12px; }
  table.data thead th, table.data tbody td { padding: 10px 12px; }
  .hero-card { flex-direction: column; align-items: flex-start; }
  .hero-card__content { max-width: 100%; }
  .drawer { width: 100vw; }
}

/* ---------- Utility ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 4px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.text-muted { color: var(--mai-fg-3); }
.text-sm { font-size: 12.5px; }
.flex-1 { flex: 1; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.divider { height: 1px; background: #EEF0F8; margin: 12px 0; }
