:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fff7fb;
  color: #1f1f28;
  --mia-pink: #d41470;
  --mia-pink-soft: #f4209d;
  --mia-pink-dark: #a70f59;
  --mia-ink: #1f1f28;
  --mia-muted: #6b6470;
  --mia-border: rgba(31, 31, 40, 0.12);
  --mia-surface: rgba(255, 255, 255, 0.9);
  --mia-shadow: 0 24px 80px rgba(160, 15, 84, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(244, 32, 157, 0.2), transparent 32rem), linear-gradient(135deg, #fff7fb 0%, #ffffff 46%, #fff0f7 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 16px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--mia-pink), var(--mia-pink-soft));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(212, 20, 112, 0.22);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.panel,
.hero-card,
.metric-card,
.modal-card {
  background: var(--mia-surface);
  border: 1px solid var(--mia-border);
  box-shadow: var(--mia-shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(100%, 440px);
  border-radius: 32px;
  padding: 28px;
}

.brand-block,
.brand-inline {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-block img,
.brand-inline img {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  object-fit: cover;
  background: #fff;
}

.brand-block span,
.brand-inline strong {
  display: block;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-block small,
.brand-inline small {
  color: var(--mia-muted);
  font-weight: 700;
}

.environment-pill,
.eyebrow,
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.environment-pill,
.eyebrow {
  margin: 18px 0 0;
  background: rgba(244, 32, 157, 0.1);
  color: var(--mia-pink-dark);
}

.login-form,
.filters-form,
.user-form,
.form-grid {
  display: grid;
  gap: 14px;
}

.login-form {
  margin-top: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--mia-muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--mia-border);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--mia-ink);
  background: rgba(255, 255, 255, 0.96);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(212, 20, 112, 0.58);
  box-shadow: 0 0 0 4px rgba(212, 20, 112, 0.1);
}

.alert,
.toast,
.empty-state {
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 800;
}

.alert {
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
}

.toast {
  position: sticky;
  top: 14px;
  z-index: 3;
  background: rgba(22, 163, 74, 0.12);
  color: #166534;
  border: 1px solid rgba(22, 163, 74, 0.22);
}

.empty-state {
  background: rgba(31, 31, 40, 0.04);
  color: var(--mia-muted);
  text-align: center;
}

.dashboard-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.hero-card,
.panel-header,
.modal-header,
.modal-actions,
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 18px;
}

.ghost-button,
.icon-button,
.actions button,
.modal-actions button:first-child,
.pagination button {
  background: #fff;
  color: var(--mia-pink-dark);
  border: 1px solid rgba(212, 20, 112, 0.2);
  box-shadow: none;
}

.hero-card {
  align-items: flex-start;
  border-radius: 32px;
  padding: 24px;
  margin-bottom: 18px;
}

.hero-card h1 {
  margin: 10px 0 8px;
  font-size: clamp(30px, 6vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.hero-card p {
  margin: 0;
  max-width: 680px;
  color: var(--mia-muted);
  font-size: 16px;
  line-height: 1.6;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  border-radius: 24px;
  padding: 18px;
}

.metric-card span,
.metric-card small,
.customer-cell small {
  display: block;
  color: var(--mia-muted);
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.panel {
  border-radius: 28px;
  padding: 18px;
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header strong {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.panel-header small {
  color: var(--mia-muted);
  font-weight: 800;
}

.filters-form {
  grid-template-columns: 1fr;
  margin-bottom: 16px;
}

.search-field {
  grid-column: 1 / -1;
}

.customer-list {
  display: grid;
  border: 1px solid var(--mia-border);
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
}

.customer-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.88fr) minmax(0, 0.66fr) minmax(0, 1fr) minmax(64px, 0.48fr) minmax(78px, 0.52fr) minmax(82px, 0.62fr) minmax(94px, 0.72fr);
  gap: 12px;
  align-items: center;
}

.customer-list-header {
  padding: 14px 16px;
  color: var(--mia-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(31, 31, 40, 0.02);
}

.customer-card {
  padding: 16px;
  border-top: 1px solid rgba(31, 31, 40, 0.08);
}

.customer-cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

.customer-cell strong,
.customer-cell span,
.customer-cell small {
  max-width: 100%;
}

.customer-cell strong {
  display: block;
}

.customer-cell-label {
  display: none;
  margin-bottom: 5px;
  color: var(--mia-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.customer-actions button {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  white-space: normal;
  line-height: 1.1;
}

@media (max-width: 1080px) {
  .customer-list-header {
    display: none;
  }

  .customer-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-card {
    gap: 14px;
  }

  .customer-cell-label {
    display: block;
  }

  .customer-actions-cell {
    grid-column: 1 / -1;
  }

  .customer-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .customer-row {
    grid-template-columns: 1fr;
  }

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

.pill {
  padding: 6px 10px;
  text-transform: none;
  letter-spacing: 0;
}

.pill.pink {
  background: rgba(244, 32, 157, 0.1);
  color: var(--mia-pink-dark);
}

.pill.ok {
  background: rgba(22, 163, 74, 0.1);
  color: #166534;
}

.pill.muted {
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
}

.pill.danger {
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
}

.danger-button {
  color: #991b1b !important;
  border-color: rgba(220, 38, 38, 0.22) !important;
}

.pagination {
  justify-content: center;
  margin: 18px 0 0;
  color: var(--mia-muted);
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(31, 31, 40, 0.32);
}

.modal-card {
  width: min(100%, 860px);
  max-height: 92vh;
  overflow: auto;
  border-radius: 28px;
  padding: 18px;
}

.modal-header {
  align-items: flex-start;
  margin-bottom: 16px;
}

.modal-header strong {
  display: block;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.modal-header small {
  color: var(--mia-muted);
  font-weight: 800;
}

.icon-button {
  width: 44px;
  padding: 0;
  border-radius: 14px;
  font-size: 28px;
  line-height: 1;
}

.form-grid {
  grid-template-columns: 1fr;
}

.modal-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (min-width: 760px) {
  .dashboard-shell {
    padding: 28px;
  }

  .filters-form {
    grid-template-columns: 1.4fr repeat(3, minmax(130px, 0.5fr)) auto;
    align-items: end;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-backdrop {
    place-items: center;
  }
}

@media (max-width: 680px) {
  .topbar,
  .hero-card,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-card button,
  .topbar button,
  .filters-form button {
    width: 100%;
  }

  .brand-inline img {
    width: 48px;
    height: 48px;
  }
}

.stacked-cell {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.stacked-cell small,
.detail-item span {
  color: var(--mia-muted);
  font-weight: 700;
}

.modal-card-wide {
  width: min(100%, 980px);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.modal-section {
  margin-top: 18px;
  border: 1px solid var(--mia-border);
  border-radius: 22px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.modal-section h3,
.modal-section h4 {
  margin: 0 0 12px;
  color: var(--mia-ink);
  letter-spacing: -0.02em;
}

.modal-section h4 {
  margin-top: 14px;
  font-size: 14px;
}

.detail-item {
  display: grid;
  gap: 6px;
  min-height: 76px;
  border: 1px solid rgba(31, 31, 40, 0.08);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.detail-item strong {
  overflow-wrap: anywhere;
}

.empty-inline {
  border: 1px dashed var(--mia-border);
  border-radius: 16px;
  padding: 12px;
  color: var(--mia-muted);
  font-weight: 800;
}

.entitlements-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

input[readonly] {
  background: rgba(31, 31, 40, 0.04);
  color: var(--mia-muted);
}

.editable-list {
  display: grid;
  gap: 12px;
}

.editable-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  border: 1px solid rgba(31, 31, 40, 0.08);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
}

.checkbox-field {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(31, 31, 40, 0.08);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  color: var(--mia-ink);
}

.checkbox-field input {
  width: 20px;
  height: 20px;
  accent-color: var(--mia-pink);
}

.entitlement-row {
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .editable-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .entitlement-row {
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
  }
}

.danger-button-solid {
  background: #991b1b !important;
  color: #fff !important;
  border-color: #991b1b !important;
  box-shadow: 0 12px 28px rgba(153, 27, 27, 0.18) !important;
}

.danger-zone {
  border-color: rgba(220, 38, 38, 0.24);
  background: rgba(220, 38, 38, 0.04);
}

.danger-zone p {
  margin: 0 0 14px;
  color: #7f1d1d;
  font-weight: 800;
  line-height: 1.5;
}

.danger-zone-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 680px) {
  .danger-zone-actions button {
    width: 100%;
  }
}
