/* MAYAK-24 modular platform foundation. Geometry and colors use shared semantic tokens. */
:root {
  --mayak-motion-feedback: 90ms;
  --mayak-motion-state: 140ms;
  --mayak-motion-popup-in: 130ms;
  --mayak-motion-popup-out: 100ms;
  --mayak-motion-panel: 200ms;
  --mayak-motion-dialog: 190ms;
  --mayak-motion-notice: 180ms;
  --mayak-ease-state: ease-out;
  --mayak-ease-popup: cubic-bezier(.2, .8, .2, 1);
  --mayak-z-tooltip: 240;
  --mayak-z-menu: 340;
  --mayak-z-inspector: 540;
  --mayak-z-dialog: 740;
  --mayak-z-toast: 940;
  --mayak-control-height: 32px;
  --mayak-row-height: 36px;
  --mayak-panel-gap: 12px;
  --mayak-panel-padding: 12px;
}

:root[data-mayak-density="normal"] {
  --mayak-control-height: 40px;
  --mayak-row-height: 44px;
  --mayak-panel-gap: 16px;
  --mayak-panel-padding: 16px;
}

:root[data-mayak-density="compact"] :is(button, input, select, textarea) {
  --mayak-active-control-height: var(--mayak-control-height);
}

:root[data-mayak-density="compact"] :is(.redesign-nav-item, .redesign-add-button) {
  min-height: 36px;
}

:root[data-mayak-density="normal"] :is(.redesign-nav-item, .redesign-add-button) {
  min-height: 44px;
}

.redesign-nav-item[hidden],
.mayak-role-home [data-mayak-widget-id][hidden] {
  display: none !important;
}

.redesign-nav-item[data-mayak-module-favorite="1"] {
  box-shadow: inset 2px 0 0 var(--mayak-accent, #315eea);
}

.mayak-future-modules-trigger {
  margin-top: 4px;
  color: var(--mayak-text-muted, #69728f);
}

.mayak-platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.mayak-platform-overlay-root {
  position: fixed;
  inset: 0;
  z-index: var(--mayak-z-dialog);
  pointer-events: none;
  --mayak-text: var(--redesign-text, #152042);
  --mayak-text-muted: var(--redesign-muted, #69728f);
  --mayak-surface-1: var(--redesign-surface, #fff);
  --mayak-surface-2: var(--redesign-surface-soft, #f8f9fd);
  --mayak-border: var(--redesign-line, #e2e6f0);
  --mayak-border-strong: var(--redesign-line-strong, #cfd5e4);
  --mayak-accent: var(--redesign-accent, #315eea);
  --mayak-overlay: var(--redesign-overlay, rgba(18, 24, 45, .48));
}

.mayak-platform-overlay {
  position: fixed;
  inset: 56px 0 0 var(--redesign-sidebar-width, 208px);
  display: grid;
  pointer-events: auto;
  opacity: 0;
  transition: opacity var(--mayak-motion-panel) var(--mayak-ease-state);
}

.mayak-platform-overlay.is-open {
  opacity: 1;
}

.mayak-platform-overlay.is-closing {
  opacity: 0;
  transition-duration: var(--mayak-motion-popup-out);
}

.mayak-platform-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--mayak-overlay, rgba(18, 24, 45, .48));
  cursor: default;
}

.mayak-platform-drawer {
  position: relative;
  justify-self: end;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(var(--mayak-platform-drawer-width, 480px), 100%);
  height: 100%;
  min-width: 0;
  overflow: hidden;
  color: var(--mayak-text, #152042);
  background: var(--mayak-surface-1, #fff);
  border-left: 1px solid var(--mayak-border, #e2e6f0);
  box-shadow: -18px 0 54px rgba(10, 16, 35, .18);
  transform: translateX(18px);
  transition: transform var(--mayak-motion-panel) var(--mayak-ease-popup);
}

.mayak-platform-overlay.is-open .mayak-platform-drawer {
  transform: translateX(0);
}

.mayak-platform-drawer > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--mayak-border, #e2e6f0);
}

.mayak-platform-drawer > header > div {
  min-width: 0;
}

.mayak-platform-drawer > header span {
  display: block;
  margin-bottom: 4px;
  color: var(--mayak-accent, #315eea);
  font-size: 10px;
  font-weight: 700;
  line-height: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mayak-platform-drawer > header h2,
.mayak-platform-drawer > header p {
  margin: 0;
}

.mayak-platform-drawer > header h2 {
  font-size: 20px;
  line-height: 28px;
}

.mayak-platform-drawer > header p {
  margin-top: 4px;
  color: var(--mayak-text-muted, #69728f);
  font-size: 12px;
  line-height: 18px;
}

.mayak-platform-drawer > header > button,
.mayak-platform-order-actions button {
  display: grid;
  place-items: center;
  width: var(--mayak-control-height);
  height: var(--mayak-control-height);
  padding: 0;
  color: var(--mayak-text-muted, #69728f);
  background: var(--mayak-surface-2, #f8f9fd);
  border: 1px solid var(--mayak-border, #e2e6f0);
  border-radius: 8px;
}

.mayak-platform-drawer-body {
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 24px;
}

.mayak-platform-drawer > footer {
  padding: 12px 20px;
  border-top: 1px solid var(--mayak-border, #e2e6f0);
}

.mayak-platform-dialog-layer {
  place-items: center;
  padding: 24px;
}

.mayak-platform-dialog-layer .mayak-platform-dialog {
  justify-self: center;
  width: min(var(--mayak-platform-drawer-width, 480px), 100%);
  height: auto;
  max-height: min(720px, 100%);
  border: 1px solid var(--mayak-border, #e2e6f0);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(10, 16, 35, .28);
  transform: translateY(6px);
}

.mayak-platform-dialog-layer.is-open .mayak-platform-dialog {
  transform: translateY(0);
}

.mayak-platform-future-list {
  display: grid;
  gap: 12px;
}

.mayak-platform-future-list article {
  padding: 16px;
  background: var(--mayak-surface-2, #f8f9fd);
  border: 1px solid var(--mayak-border, #e2e6f0);
  border-radius: 12px;
}

.mayak-platform-future-list article > header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mayak-platform-future-list article > header .redesign-icon {
  width: 36px;
  height: 36px;
  color: var(--mayak-accent, #315eea);
  background: var(--mayak-accent-soft, #edf2ff);
  border-radius: 8px;
}

.mayak-platform-future-list h3,
.mayak-platform-future-list p,
.mayak-platform-future-list dl {
  margin: 0;
}

.mayak-platform-future-list h3 {
  color: var(--mayak-text, #152042);
  font-size: 15px;
  line-height: 20px;
}

.mayak-platform-future-list header span:not(.redesign-icon) {
  margin: 1px 0 0;
  color: var(--mayak-text-muted, #69728f);
  font-size: 11px;
  line-height: 14px;
}

.mayak-platform-future-list p {
  margin-top: 10px;
  color: var(--mayak-text-muted, #69728f);
  font-size: 13px;
  line-height: 18px;
}

.mayak-platform-future-list dl {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.mayak-platform-future-list dl div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  font-size: 11px;
  line-height: 16px;
}

.mayak-platform-future-list dt {
  color: var(--mayak-text-subtle, #8a93ab);
}

.mayak-platform-future-list dd {
  margin: 0;
  color: var(--mayak-text, #152042);
}

.mayak-platform-setting-group > header h3,
.mayak-platform-setting-group > header p {
  margin: 0;
}

.mayak-platform-setting-group > header h3 {
  font-size: 15px;
  line-height: 22px;
}

.mayak-platform-setting-group > header p {
  margin-top: 3px;
  color: var(--mayak-text-muted, #69728f);
  font-size: 12px;
  line-height: 18px;
}

.mayak-platform-widget-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.mayak-platform-widget-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 10px;
  background: var(--mayak-surface-2, #f8f9fd);
  border: 1px solid var(--mayak-border, #e2e6f0);
  border-radius: 8px;
}

.mayak-platform-widget-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mayak-platform-widget-list label > span {
  display: grid;
  min-width: 0;
}

.mayak-platform-widget-list strong,
.mayak-platform-widget-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mayak-platform-widget-list strong {
  font-size: 13px;
  line-height: 18px;
}

.mayak-platform-widget-list small {
  color: var(--mayak-text-muted, #69728f);
  font-size: 11px;
  line-height: 14px;
}

.mayak-platform-widget-list select {
  width: 100%;
  height: var(--mayak-control-height);
  color: var(--mayak-text, #152042);
  background: var(--mayak-surface-1, #fff);
  border: 1px solid var(--mayak-border-strong, #cfd5e4);
  border-radius: 6px;
}

.mayak-platform-order-actions {
  display: flex;
  gap: 4px;
}

.mayak-platform-order-actions button:first-child .redesign-icon {
  transform: rotate(-90deg);
}

.mayak-platform-order-actions button:last-child .redesign-icon {
  transform: rotate(90deg);
}

.mayak-platform-context-menu {
  position: fixed;
  z-index: var(--mayak-z-menu);
  display: grid;
  width: min(280px, calc(100vw - 16px));
  padding: 6px;
  color: var(--mayak-text, #152042);
  background: var(--mayak-surface-1, #fff);
  border: 1px solid var(--mayak-border-strong, #cfd5e4);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20, 29, 57, .16);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--mayak-motion-popup-in) var(--mayak-ease-popup), transform var(--mayak-motion-popup-in) var(--mayak-ease-popup);
}

.mayak-platform-context-menu.is-open {
  opacity: 1;
  transform: translateY(0);
}

.mayak-platform-context-menu.is-closing {
  opacity: 0;
  transition-duration: var(--mayak-motion-popup-out);
}

.mayak-platform-context-menu > button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 8px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  transition: background var(--mayak-motion-feedback) var(--mayak-ease-state), color var(--mayak-motion-feedback) var(--mayak-ease-state);
}

.mayak-platform-context-menu > button:hover,
.mayak-platform-context-menu > button:focus-visible {
  background: var(--mayak-surface-2, #f8f9fd);
  outline: none;
}

.mayak-platform-context-menu > button:active {
  transform: scale(.99);
}

.mayak-platform-context-menu > button.is-dangerous {
  color: var(--mayak-danger, #b9364a);
}

.mayak-platform-context-menu > button span:not(.redesign-icon) {
  display: grid;
  min-width: 0;
}

.mayak-platform-context-menu > button strong {
  font-size: 13px;
  font-weight: 600;
  line-height: 17px;
}

.mayak-platform-context-menu > button small,
.mayak-platform-context-menu kbd {
  color: var(--mayak-text-muted, #69728f);
  font-size: 10px;
  line-height: 13px;
}

.mayak-platform-context-menu kbd {
  font-family: inherit;
}

.mayak-platform-floating {
  position: fixed;
  z-index: var(--mayak-z-tooltip);
  max-width: min(360px, calc(100vw - 16px));
  color: var(--mayak-text, #152042);
  background: var(--mayak-surface-1, #fff);
  border: 1px solid var(--mayak-border-strong, #cfd5e4);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(20, 29, 57, .16);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--mayak-motion-popup-in) var(--mayak-ease-popup), transform var(--mayak-motion-popup-in) var(--mayak-ease-popup);
}

.mayak-platform-floating.is-open {
  opacity: 1;
  transform: translateY(0);
}

.mayak-platform-floating.is-closing {
  opacity: 0;
  transition-duration: var(--mayak-motion-popup-out);
}

.mayak-platform-tooltip {
  max-width: min(260px, calc(100vw - 16px));
  padding: 5px 8px;
  color: var(--mayak-surface-1, #fff);
  background: var(--mayak-text, #152042);
  border-color: transparent;
  font-size: 11px;
  line-height: 15px;
}

.mayak-platform-popover,
.mayak-platform-hover-card {
  padding: 12px;
  font-size: 12px;
  line-height: 17px;
}

.mayak-platform-popover {
  z-index: var(--mayak-z-menu);
}

.mayak-platform-toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: var(--mayak-z-toast);
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.mayak-platform-toast {
  padding: 10px 12px;
  color: var(--mayak-text, #152042);
  background: var(--mayak-surface-1, #fff);
  border: 1px solid var(--mayak-border-strong, #cfd5e4);
  border-left: 3px solid var(--mayak-info, #2563c9);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(20, 29, 57, .16);
  font-size: 12px;
  line-height: 17px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--mayak-motion-notice, 180ms) var(--mayak-ease-state), transform var(--mayak-motion-notice, 180ms) var(--mayak-ease-state);
}

.mayak-platform-toast.is-open {
  opacity: 1;
  transform: translateY(0);
}

.mayak-platform-toast.is-error {
  border-left-color: var(--mayak-danger, #b9364a);
}

.mayak-platform-toast.is-success {
  border-left-color: var(--mayak-success, #147d59);
}

.mayak-role-home [data-mayak-widget-size="compact"] {
  min-height: 0;
}

.mayak-role-home [data-mayak-widget-size="wide"] {
  grid-column: 1 / -1;
}

.mayak-platform-empty {
  padding: 24px;
  text-align: center;
  color: var(--mayak-text-muted, #69728f);
}

.mayak-platform-empty strong {
  display: block;
  color: var(--mayak-text, #152042);
}

.mayak-platform-empty p {
  margin: 5px 0 0;
}

@media (max-width: 960px) {
  .mayak-platform-overlay {
    left: 0;
  }

  .mayak-platform-drawer {
    width: min(var(--mayak-platform-drawer-width, 480px), calc(100% - 24px));
  }
}

@media (max-width: 720px) {
  .mayak-platform-overlay {
    inset: 0;
  }

  .mayak-platform-drawer {
    width: 100%;
    border-left: 0;
  }

  .mayak-platform-widget-list article {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mayak-platform-widget-list select {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-mayak-reduced-motion="full"]) .mayak-platform-overlay,
  :root:not([data-mayak-reduced-motion="full"]) .mayak-platform-drawer,
  :root:not([data-mayak-reduced-motion="full"]) .mayak-platform-context-menu,
  :root:not([data-mayak-reduced-motion="full"]) .mayak-platform-toast,
  :root:not([data-mayak-reduced-motion="full"]) .mayak-platform-floating {
    transform: none !important;
    transition-duration: 60ms !important;
  }
}

:root[data-mayak-reduced-motion="reduce"] .mayak-platform-overlay,
:root[data-mayak-reduced-motion="reduce"] .mayak-platform-drawer,
:root[data-mayak-reduced-motion="reduce"] .mayak-platform-context-menu,
:root[data-mayak-reduced-motion="reduce"] .mayak-platform-toast,
:root[data-mayak-reduced-motion="reduce"] .mayak-platform-floating {
  transform: none !important;
  transition-duration: 60ms !important;
}
