.mp-card { border: 1px solid var(--mp-border); border-radius: var(--mp-radius-md); background: var(--mp-surface); box-shadow: var(--mp-shadow-sm); }
.mp-card-header { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px 14px; border-bottom: 1px solid var(--mp-border); }
.mp-card-body { padding: 20px; }
.mp-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid var(--mp-border); border-radius: var(--mp-radius-sm); background: var(--mp-surface); color: var(--mp-text); font-weight: 700; transition: background var(--mp-motion-fast), border-color var(--mp-motion-fast), color var(--mp-motion-fast), opacity var(--mp-motion-fast); }
.mp-button:hover { border-color: var(--mp-border-strong); background: var(--mp-surface-subtle); text-decoration: none; }
.mp-button:active { background: color-mix(in srgb, var(--mp-surface-subtle) 84%, var(--mp-border) 16%); }
.mp-button--primary { border-color: var(--mp-primary); background: var(--mp-primary); color: var(--mp-on-primary); }
.mp-button--primary:hover { border-color: var(--mp-primary-hover); background: var(--mp-primary-hover); color: var(--mp-on-primary); }
.mp-button--danger { border-color: var(--mp-danger); background: var(--mp-danger); color: #fff; }
.mp-button[aria-busy="true"] { cursor: wait; opacity: .68; }
.mp-field { display: grid; gap: 8px; }
.mp-field label, .mp-label { color: var(--mp-text); font-weight: 700; font-size: .94rem; }
.mp-input, .mp-select, .mp-textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--mp-border-strong); border-radius: var(--mp-radius-sm); background: var(--mp-surface); color: var(--mp-text); transition: border-color var(--mp-motion-fast), box-shadow var(--mp-motion-fast), background var(--mp-motion-fast); }
.mp-textarea { min-height: 116px; resize: vertical; }
.mp-input:focus, .mp-select:focus, .mp-textarea:focus { border-color: var(--mp-primary); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-primary) 18%, transparent); }
.mp-help { color: var(--mp-muted); font-size: .84rem; }
.mp-error { color: var(--mp-danger); font-size: .84rem; }
.mp-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.mp-switch { position: relative; display: inline-flex; min-width: 48px; min-height: 28px; padding: 3px; border: 0; border-radius: 999px; background: var(--mp-border-strong); }
.mp-switch::after { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); content: ""; transition: transform var(--mp-motion-fast) var(--mp-ease); }
.mp-switch[aria-checked="true"] { background: var(--mp-primary); }
.mp-switch[aria-checked="true"]::after { transform: translateX(20px); }
.mp-table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.mp-table th, .mp-table td { padding: 12px 14px; border-bottom: 1px solid var(--mp-border); text-align: left; vertical-align: middle; white-space: nowrap; }
.mp-table th { color: var(--mp-muted); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.mp-badge { display: inline-flex; min-height: 26px; align-items: center; padding: 2px 9px; border-radius: 999px; background: var(--mp-primary-soft); color: var(--mp-text); font-size: .78rem; font-weight: 700; }
.mp-state { display: grid; min-height: 190px; place-items: center; padding: 28px 20px; border: 1px dashed var(--mp-border-strong); border-radius: var(--mp-radius-md); background: var(--mp-surface); color: var(--mp-muted); text-align: center; }
.mp-state h3 { margin-bottom: 6px; font-size: 1rem; }
.mp-state p { max-width: 540px; margin-bottom: 0; }
.mp-state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.mp-skeleton { border-radius: var(--mp-radius-sm); background: var(--mp-surface-subtle); animation: mp-skeleton-pulse 1.2s ease-in-out infinite alternate; }
@keyframes mp-skeleton-pulse { to { opacity: .48; } }
.mp-dialog-layer { position: fixed; inset: 0; z-index: var(--mp-z-dialog); display: grid; padding: 18px; place-items: center; background: var(--mp-overlay); opacity: 0; pointer-events: none; transition: opacity var(--mp-motion) var(--mp-ease); }
.mp-dialog-layer.is-open { opacity: 1; pointer-events: auto; }
.mp-dialog { position: relative; width: min(540px, 100%); max-height: calc(100dvh - 36px); overflow: hidden; border: 1px solid var(--mp-border); border-radius: var(--mp-radius-lg); background: var(--mp-surface-raised); box-shadow: var(--mp-shadow-lg); transform: translateY(10px) scale(.985); transition: transform var(--mp-motion) var(--mp-ease); }
.mp-dialog-layer.is-open .mp-dialog { transform: translateY(0) scale(1); }
.mp-dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 14px; }
.mp-dialog__body { max-height: calc(100dvh - 190px); padding: 0 20px 20px; overflow-y: auto; overscroll-behavior: contain; }
.mp-dialog__footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 20px; border-top: 1px solid var(--mp-border); }
.mp-dialog.mp-doc-dialog { display: flex; flex-direction: column; height: calc(100dvh - 36px); }
.mp-dialog.mp-doc-dialog .mp-dialog__body { flex: 1; min-height: 0; max-height: none; overflow: hidden; display: flex; }
.mp-dialog.mp-doc-dialog .mp-dialog__footer { flex: 0 0 auto; }
.mp-doc-modal { display: grid; gap: 12px; min-width: 0; }
.mp-doc-modal { flex: 1; min-height: 0; }
.mp-doc-modal__frame { width: 100%; height: 100%; min-height: 0; border: 1px solid var(--mp-border); border-radius: var(--mp-radius-sm); background: var(--mp-bg); }
.mp-doc-qr { display: grid; justify-items: center; gap: 12px; }
.mp-doc-qr__image { width: min(70vw, 280px); aspect-ratio: 1; object-fit: contain; border: 1px solid var(--mp-border); border-radius: var(--mp-radius-sm); background: var(--mp-surface); padding: 12px; }
.mp-toast-region { position: fixed; top: calc(var(--mp-topbar-height) + 12px); left: calc(50% + var(--mp-sidebar-width) / 2); z-index: var(--mp-z-toast); display: grid; width: min(420px, calc(100vw - 32px)); justify-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.mp-toast { display: grid; grid-template-columns: 28px minmax(0, 1fr) 28px; width: fit-content; min-width: min(300px, 100%); max-width: 100%; min-height: 52px; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--mp-border); border-radius: var(--mp-radius-md); background: var(--mp-surface-raised); color: var(--mp-text); box-shadow: var(--mp-shadow-md); opacity: 0; transform: translateY(-8px) scale(.98); transition: opacity var(--mp-motion-fast) var(--mp-ease), transform var(--mp-motion-fast) var(--mp-ease); pointer-events: auto; }
.mp-toast.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.mp-toast.is-leaving { opacity: 0; transform: translateY(-5px) scale(.985); }
.mp-toast__icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: var(--mp-radius-sm); background: var(--mp-primary-soft); color: var(--mp-primary); }
.mp-toast__icon .mp-icon { width: 17px; height: 17px; }
.mp-toast__message { min-width: 0; font-size: .86rem; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.mp-toast__close { display: grid; width: 28px; height: 28px; padding: 0; place-items: center; border: 0; border-radius: var(--mp-radius-sm); background: transparent; color: var(--mp-muted); cursor: pointer; }
.mp-toast__close:hover { background: var(--mp-surface-subtle); color: var(--mp-text); }
.mp-toast__close:focus-visible { outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-primary) 18%, transparent); }
.mp-toast__close .mp-icon { width: 16px; height: 16px; }
.mp-toast--success .mp-toast__icon { background: var(--mp-success-soft); color: var(--mp-success); }
.mp-toast--error .mp-toast__icon { background: var(--mp-danger-soft); color: var(--mp-danger); }
.mp-toast--warning .mp-toast__icon { background: var(--mp-warning-soft); color: var(--mp-warning); }

.mp-action-menu { position: relative; display: inline-flex; }
.mp-action-menu > summary { list-style: none; cursor: pointer; }
.mp-action-menu > summary::-webkit-details-marker { display: none; }
.mp-action-menu > summary::marker { content: ""; }
.mp-action-menu[open] > summary { border-color: var(--mp-border); background: var(--mp-surface-subtle); color: var(--mp-text); }
.mp-action-menu__panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; display: grid; width: max-content; min-width: 190px; gap: 2px; padding: 6px; border: 1px solid var(--mp-border); border-radius: var(--mp-radius-md); background: var(--mp-surface-raised); box-shadow: var(--mp-shadow-md); }
.mp-action-menu--up .mp-action-menu__panel { top: auto; bottom: calc(100% + 6px); }
.mp-action-menu__item { display: flex; width: 100%; min-height: 40px; align-items: center; gap: 9px; padding: 0 10px; border: 0; border-radius: var(--mp-radius-sm); background: transparent; color: var(--mp-text); font-size: .84rem; font-weight: 650; text-align: left; cursor: pointer; }
.mp-action-menu__item:hover { background: var(--mp-surface-subtle); }
.mp-action-menu__item:focus-visible { outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-primary) 18%, transparent); }
.mp-action-menu__item--danger { color: var(--mp-danger); }
.mp-action-menu__item--danger:hover { background: var(--mp-danger-soft); }
.mp-action-menu__item .mp-icon { width: 17px; height: 17px; }

@media (max-width: 1023px) {
  .mp-toast-region { left: 50%; }
}

@media (max-width: 767px) {
  .mp-card-header, .mp-card-body { padding-right: 14px; padding-left: 14px; }
  .mp-form-actions, .mp-dialog__footer { align-items: stretch; flex-direction: column-reverse; }
  .mp-form-actions .mp-button, .mp-dialog__footer .mp-button { width: 100%; }
  .mp-dialog-layer { padding: 10px; }
  .mp-dialog { max-height: calc(100dvh - 20px); }
  .mp-dialog__body { max-height: calc(100dvh - 168px); }
  .mp-dialog.mp-doc-dialog { height: calc(100dvh - 20px); }
  .mp-toast-region { top: calc(var(--mp-topbar-height) + 8px); width: calc(100vw - 24px); }
  .mp-toast { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) { .mp-skeleton { animation: none; } .mp-toast { transition: none; } }
