.emt-main-card {
  background: var(--emt-surface);
  border: 1px solid var(--emt-divider);
  border-radius: var(--emt-radius-card);
}

.emt-main-card__header,
.emt-main-card__body,
.emt-main-card__footer {
  padding: var(--emt-space-5);
}

.emt-main-card__header {
  border-bottom: 1px solid var(--emt-divider);
}

.emt-main-card__footer {
  border-top: 1px solid var(--emt-divider);
}

.emt-kpi-card {
  min-width: 0;
  padding: var(--emt-space-5);
  background: var(--emt-surface);
  border: 1px solid var(--emt-divider);
  border-radius: var(--emt-radius-card);
}

.emt-kpi-card__label {
  margin: 0;
  color: var(--emt-text-secondary);
  font-size: var(--emt-font-size-sm);
  font-weight: 500;
}

.emt-kpi-card__value {
  margin: var(--emt-space-2) 0 0;
  color: var(--emt-text);
  font-size: var(--emt-font-size-xl);
  font-weight: 600;
  line-height: var(--emt-line-height-tight);
}

.emt-filter-bar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: var(--emt-space-3);
  padding: var(--emt-space-4);
  background: var(--emt-surface);
  border: 1px solid var(--emt-divider);
  border-radius: var(--emt-radius-card);
}

.emt-field {
  min-width: min(100%, 180px);
  display: grid;
  gap: 6px;
  color: var(--emt-text);
  font: 500 var(--emt-font-size-sm)/20px var(--emt-font-sans);
}

.emt-field input,
.emt-field select,
.emt-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--emt-text);
  background: var(--emt-surface);
  border: 1px solid #b7c0cc;
  border-radius: var(--emt-radius-control);
  font: 400 var(--emt-font-size-sm)/20px var(--emt-font-sans);
  transition: border-color var(--emt-motion-fast), box-shadow var(--emt-motion-fast);
}

.emt-field textarea {
  min-height: 96px;
  resize: vertical;
}

.emt-field input::placeholder,
.emt-field textarea::placeholder {
  color: #5f6b7a;
  opacity: 1;
}

.emt-field input:hover:not(:disabled):not(:focus),
.emt-field select:hover:not(:disabled):not(:focus),
.emt-field textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--emt-primary-border) !important;
}

.emt-field input:focus,
.emt-field select:focus,
.emt-field textarea:focus {
  border-color: var(--emt-primary) !important;
  outline: 0;
  box-shadow: 0 0 0 3px rgb(22 163 74 / 16%) !important;
}

.emt-field input:disabled,
.emt-field select:disabled,
.emt-field textarea:disabled {
  color: #6b7280;
  background: #f1f3f5;
  cursor: not-allowed;
}

.emt-field input[aria-invalid='true'],
.emt-field select[aria-invalid='true'],
.emt-field textarea[aria-invalid='true'] {
  border-color: var(--emt-danger) !important;
}

.emt-field input[aria-invalid='true']:focus,
.emt-field select[aria-invalid='true']:focus,
.emt-field textarea[aria-invalid='true']:focus {
  box-shadow: 0 0 0 3px rgb(211 47 47 / 16%) !important;
}

.emt-field__error {
  color: #b42318;
  font-size: var(--emt-font-size-xs);
}

.emt-button {
  box-sizing: border-box;
  min-height: 40px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--emt-radius-control);
  font: 600 14px/20px 'Public Sans', 'Segoe UI', sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--emt-motion-fast), border-color var(--emt-motion-fast), color var(--emt-motion-fast);
}

.emt-button:focus-visible {
  outline: 3px solid rgb(22 163 74 / 24%) !important;
  outline-offset: 2px !important;
}

.emt-button:disabled,
.emt-button[aria-disabled='true'] {
  opacity: .58;
  cursor: not-allowed !important;
  pointer-events: none;
}

.emt-button[aria-busy='true'] {
  position: relative;
  color: transparent !important;
  cursor: wait !important;
  pointer-events: none;
}

.emt-button[aria-busy='true']::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgb(255 255 255 / 46%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: emt-control-spin 700ms linear infinite;
}

.emt-button--secondary[aria-busy='true']::after {
  border-color: rgb(22 163 74 / 28%);
  border-top-color: var(--emt-primary);
}

.emt-button--primary {
  color: var(--emt-on-primary) !important;
  background: var(--emt-primary-hover) !important;
  border-color: var(--emt-primary-hover) !important;
}

.emt-button--primary:hover {
  color: #fff !important;
  background: var(--emt-primary-active) !important;
  border-color: var(--emt-primary-active) !important;
}

.emt-button--primary:active:not(:disabled):not([aria-disabled='true']):not([aria-busy='true']) {
  background: var(--emt-primary-active) !important;
  border-color: var(--emt-primary-active) !important;
  transform: translateY(1px);
}

.emt-button--secondary {
  color: var(--emt-text) !important;
  background: var(--emt-surface) !important;
  border-color: #b7c0cc !important;
}

.emt-button--secondary:hover {
  color: var(--emt-primary-hover) !important;
  border-color: var(--emt-primary-border) !important;
}

.emt-button--secondary:active:not(:disabled):not([aria-disabled='true']):not([aria-busy='true']) {
  color: var(--emt-primary-active) !important;
  background: var(--emt-primary-active-soft) !important;
  border-color: var(--emt-primary-border) !important;
  transform: translateY(1px);
}

.emt-button--danger {
  color: #fff !important;
  background: var(--emt-danger) !important;
  border-color: var(--emt-danger) !important;
}

.emt-button--danger:hover {
  background: var(--emt-danger-hover) !important;
  border-color: var(--emt-danger-hover) !important;
}

.emt-button--danger:active:not(:disabled):not([aria-disabled='true']):not([aria-busy='true']) {
  background: var(--emt-danger-active) !important;
  border-color: var(--emt-danger-active) !important;
  transform: translateY(1px);
}

.emt-button--warning {
  color: #fff !important;
  background: var(--emt-warning) !important;
  border-color: var(--emt-warning) !important;
}

.emt-button--warning:hover {
  color: #fff !important;
  background: #93370d !important;
  border-color: #93370d !important;
}

.emt-button--warning:active:not(:disabled):not([aria-disabled='true']):not([aria-busy='true']) {
  background: #7a2e0e !important;
  border-color: #7a2e0e !important;
  transform: translateY(1px);
}

.emt-button--compact {
  min-height: 34px;
  padding: 6px 12px;
  font-size: var(--emt-font-size-xs);
}

.emt-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--emt-divider);
  border-radius: var(--emt-radius-card);
  background: var(--emt-surface);
}

.emt-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--emt-text);
  font: 400 var(--emt-font-size-sm)/20px var(--emt-font-sans);
}

.emt-table th,
.emt-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--emt-divider);
}

.emt-table th {
  color: var(--emt-text-secondary);
  background: var(--emt-canvas);
  font-weight: 600;
}

.emt-table tbody tr:last-child td {
  border-bottom: 0;
}

.emt-table tbody tr:hover td {
  background: #f7faf8;
}

.emt-tabs {
  display: flex;
  gap: var(--emt-space-1);
  overflow-x: auto;
  border-bottom: 1px solid var(--emt-divider);
}

.emt-tabs__tab {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--emt-text-secondary) !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  box-shadow: none !important;
  font: 600 var(--emt-font-size-sm)/20px var(--emt-font-sans);
  cursor: pointer;
}

.emt-tabs__tab:hover,
.emt-tabs__tab[aria-selected='true'] {
  color: var(--emt-primary) !important;
  border-bottom-color: var(--emt-primary) !important;
}

.emt-tabs__tab:focus-visible {
  outline: 3px solid rgb(22 163 74 / 24%) !important;
  outline-offset: -3px !important;
}

.emt-tabs__tab:active:not(:disabled):not([aria-disabled='true']):not([aria-busy='true']) {
  background: var(--emt-primary-soft) !important;
  transform: none !important;
}

.emt-tabs__tab:disabled,
.emt-tabs__tab[aria-disabled='true'] {
  opacity: .52;
  color: #6b7280 !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

.emt-tabs__tab[aria-busy='true'] {
  opacity: .68;
  cursor: wait !important;
  pointer-events: none;
}

@keyframes emt-control-spin {
  to { transform: rotate(360deg); }
}

.emt-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  color: #475467;
  background: #f2f4f7;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  font: 600 var(--emt-font-size-xs)/18px var(--emt-font-sans);
}

.emt-chip--success { color: #067647; background: #ecfdf3; border-color: #abefc6; }
.emt-chip--warning { color: #854a0e; background: #fffaeb; border-color: #fedf89; }
.emt-chip--danger { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.emt-chip--info { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }

.emt-alert {
  padding: 12px 14px;
  color: var(--emt-text);
  background: var(--emt-canvas);
  border: 1px solid var(--emt-divider);
  border-radius: var(--emt-radius-card);
  font: 400 var(--emt-font-size-sm)/20px var(--emt-font-sans);
}

.emt-alert--success { color: #066b43; background: #ecfdf3; border-color: #abefc6; }
.emt-alert--warning { color: #854a0e; background: #fffaeb; border-color: #fedf89; }
.emt-alert--danger { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.emt-alert--info { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }

.emt-dialog {
  position: fixed;
  z-index: 60;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: var(--emt-text);
  background: var(--emt-surface);
  border: 0;
  border-radius: var(--emt-radius-card);
  box-shadow: var(--emt-shadow-overlay);
}

.emt-dialog[hidden],
.emt-dialog-backdrop[hidden] {
  display: none;
}

.emt-dialog-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  background: rgb(15 23 42 / 45%);
}

.emt-dialog::backdrop {
  background: rgb(15 23 42 / 45%);
}

.emt-dialog__header,
.emt-dialog__body,
.emt-dialog__footer {
  padding: var(--emt-space-5);
}

.emt-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--emt-space-4);
  border-bottom: 1px solid var(--emt-divider);
}

.emt-dialog__header h2 {
  margin: 0;
  font-size: var(--emt-font-size-lg);
}

.emt-dialog__body {
  min-height: 0;
  overflow-y: auto;
}

.emt-dialog > form {
  grid-row: 2 / 4;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.emt-dialog__footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--emt-space-2);
  border-top: 1px solid var(--emt-divider);
}

.emt-dialog__close {
  min-width: 40px;
  padding-inline: 10px;
}

.emt-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--emt-space-4);
}

.emt-field--full {
  grid-column: 1 / -1;
}

.emt-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--emt-space-3);
  padding-top: var(--emt-space-4);
  border-top: 1px solid var(--emt-divider);
}

.emt-form-status {
  min-height: 20px;
  margin: 0;
  flex: 1 1 240px;
  color: var(--emt-text-secondary);
  font-size: var(--emt-font-size-sm);
  line-height: 20px;
}

.emt-form-help {
  padding: var(--emt-space-4);
  color: var(--emt-text-secondary);
  background: var(--emt-canvas);
  border: 1px solid var(--emt-divider);
  border-radius: var(--emt-radius-card);
  font-size: var(--emt-font-size-sm);
  line-height: var(--emt-line-height-base);
}

.emt-form-help h2 {
  margin: 0 0 var(--emt-space-2);
  color: var(--emt-text);
  font-size: var(--emt-font-size-base);
  font-weight: 600;
}

.emt-form-help ul {
  margin: 0;
  padding-left: var(--emt-space-5);
}

.emt-form-help li + li {
  margin-top: var(--emt-space-1);
}

.emt-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: var(--emt-space-2);
  margin-top: var(--emt-space-4);
}

.emt-pagination .emt-button[aria-current='page'] {
  color: var(--emt-on-primary) !important;
  background: var(--emt-primary-hover) !important;
  border-color: var(--emt-primary-hover) !important;
}

@media (max-width: 560px) {
  .emt-form-grid { grid-template-columns: 1fr; }
  .emt-form-actions { align-items: stretch; flex-direction: column; }
  .emt-form-actions .emt-button { width: 100%; }
  .emt-form-status { flex-basis: auto; }
  .emt-dialog__header,
  .emt-dialog__body,
  .emt-dialog__footer { padding: var(--emt-space-4); }
  .emt-dialog__footer .emt-button { flex: 1 1 auto; }
}

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

.emt-dialog__surface {
  min-height: 0;
  max-height: inherit;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.emt-dialog--profile .emt-dialog__body {
  display: grid;
  gap: var(--emt-space-3);
}

.emt-dialog--profile label,
.emt-dialog-section-title {
  color: var(--emt-text);
  font: 600 var(--emt-font-size-sm)/20px var(--emt-font-sans);
}

.emt-dialog-section-title {
  margin-top: var(--emt-space-2);
  padding-top: var(--emt-space-4);
  border-top: 1px solid var(--emt-divider);
}

.emt-dialog--profile input,
.emt-dialog--profile select,
.emt-dialog--profile textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--emt-text);
  background: var(--emt-surface);
  border: 1px solid #b7c0cc;
  border-radius: var(--emt-radius-control);
  font: 400 var(--emt-font-size-sm)/20px var(--emt-font-sans);
}

.emt-dialog--profile textarea {
  min-height: 96px;
  resize: vertical;
}

.emt-dialog--profile input::placeholder,
.emt-dialog--profile textarea::placeholder {
  color: #5f6b7a;
  opacity: 1;
}

.emt-dialog--profile input:focus,
.emt-dialog--profile select:focus,
.emt-dialog--profile textarea:focus {
  border-color: var(--emt-primary);
  outline: 0;
  box-shadow: 0 0 0 3px rgb(22 163 74 / 16%);
}

.emt-dialog--profile input[readonly] {
  color: var(--emt-text-secondary);
  background: var(--emt-canvas);
}

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

.emt-dialog--profile .emt-form-grid > div {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.emt-required {
  color: #b42318;
}

@media (max-width: 720px) {
  .emt-dialog--profile {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

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

.emt-skeleton {
  min-height: 16px;
  overflow: hidden;
  background: #edf0f4;
  border-radius: var(--emt-radius-control);
  animation: emt-skeleton-pulse 1.6s ease-in-out infinite;
}

@keyframes emt-skeleton-pulse {
  50% { opacity: .55; }
}

.emt-empty-state {
  max-width: 560px;
  margin-inline: auto;
  padding: var(--emt-space-8) var(--emt-space-6);
  text-align: center;
}

.emt-empty-state__title {
  margin: 0;
  color: var(--emt-text);
  font-size: var(--emt-font-size-lg);
  line-height: var(--emt-line-height-tight);
}

.emt-empty-state__body {
  max-width: 65ch;
  margin: var(--emt-space-2) auto 0;
  color: var(--emt-text-secondary);
  font-size: var(--emt-font-size-sm);
  line-height: var(--emt-line-height-base);
}
.emt-period-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--emt-space-2);
}

.emt-period-presets .emt-button {
  min-height: 36px;
}
