:root {
  --app-shell-width: var(--ds-shell-width);
  --app-line: var(--ds-line);
  --app-brand-blue: var(--ds-brand);
  --app-panel: var(--ds-surface);
  --app-shadow: var(--ds-shadow-shell);
  --motion-fast: var(--ds-motion-fast);
  --motion-base: var(--ds-motion-base);
  --motion-slow: 260ms;
  --motion-ease: var(--ds-ease);
}

.app-header {
  box-sizing: border-box;
  width: min(var(--app-shell-width), 100%);
  margin: 0 auto 12px;
  position: relative;
  z-index: 30;
  overflow: visible;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 24px 18px;
  border: 1px solid rgba(217, 227, 238, 0.9);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,251,255,0.84));
  box-shadow: var(--app-shadow);
  transition:
    box-shadow var(--motion-base) var(--motion-ease),
    border-color var(--motion-base) var(--motion-ease),
    background-color var(--motion-base) var(--motion-ease);
}

.app-trial-banner {
  width: min(var(--app-shell-width), 100%);
  margin: 0 auto 12px;
  padding: 0 10px;
}

.app-trial-banner-inner {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid #e9d4a2;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(255, 206, 112, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(255,251,243,0.98), rgba(255,244,222,0.94));
  color: #875400;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.88),
    0 10px 20px rgba(16, 32, 57, 0.05);
}

.app-trial-banner.is-expired .app-trial-banner-inner {
  border-color: #efc2c2;
  background:
    radial-gradient(circle at top right, rgba(222, 92, 92, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255,248,248,0.98), rgba(255,238,238,0.94));
  color: #9f1d1d;
}

.app-trial-banner-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(135, 84, 0, 0.16);
  background: rgba(255,255,255,0.72);
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-trial-banner.is-expired .app-trial-banner-chip {
  border-color: rgba(159, 29, 29, 0.18);
}

.app-trial-banner-copy {
  display: grid;
  gap: 2px;
  flex: 1 1 440px;
  min-width: 240px;
}

.app-trial-banner-title {
  color: #4b3710;
  font-size: 13px;
  line-height: 1.2;
}

.app-trial-banner.is-expired .app-trial-banner-title {
  color: #7f1d1d;
}

.app-trial-banner-text {
  color: #7f6540;
  font-size: 12px;
  line-height: 1.45;
}

.app-trial-banner.is-expired .app-trial-banner-text {
  color: #8f3a3a;
}

.app-trial-banner-meta {
  display: grid;
  gap: 2px;
  padding: 6px 10px;
  border-left: 1px solid rgba(135, 84, 0, 0.14);
  min-width: 120px;
}

.app-trial-banner.is-expired .app-trial-banner-meta {
  border-left-color: rgba(159, 29, 29, 0.16);
}

.app-trial-banner-meta-label {
  color: #8a6c42;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app-trial-banner-meta strong {
  color: inherit;
  font-size: 12px;
  line-height: 1.3;
}

.app-header-in-shell {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  position: relative;
  z-index: 30;
  overflow: visible;
  padding: 22px 24px 18px;
  border: 0;
  border-bottom: 1px solid rgba(217, 227, 238, 0.9);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,251,255,0.84));
  box-shadow: none;
}

.app-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  text-decoration: none;
  transition: transform var(--motion-base) var(--motion-ease), opacity var(--motion-base) var(--motion-ease);
}

.app-brand:hover {
  transform: translateY(-1px);
}

.app-brand-logo {
  width: 186px;
  max-width: 100%;
  height: auto;
  display: block;
  transition: transform var(--motion-base) var(--motion-ease), filter var(--motion-base) var(--motion-ease);
}

.app-brand:hover .app-brand-logo {
  transform: translateY(-1px);
  filter: saturate(1.02);
}

.app-header-actions {
  display: flex;
  margin-left: auto;
  flex: 0 0 auto;
  position: relative;
  z-index: 31;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.app-notification-menu,
.app-user-menu {
  position: relative;
}

.app-notification-trigger {
  list-style: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: rgba(248, 251, 255, 0.92);
  color: #1f3a5f;
  cursor: pointer;
  transition:
    border-color var(--motion-fast) var(--motion-ease),
    background-color var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease);
}

.app-notification-trigger::-webkit-details-marker {
  display: none;
}

.app-notification-trigger:hover {
  transform: translateY(-1px);
}

.app-notification-menu[open] .app-notification-trigger {
  border-color: rgba(0, 0, 120, 0.22);
  box-shadow: 0 0 0 4px rgba(0, 0, 120, 0.08);
}

.app-notification-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #28446e;
}

.app-notification-bell svg {
  width: 18px;
  height: 18px;
  display: block;
}

.app-notification-count {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #c0002b;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.98);
}

.app-notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(70vh, 520px);
  padding: 10px;
  border: 1px solid rgba(217, 227, 238, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 44px rgba(18, 34, 56, 0.16);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 45;
  overflow: hidden;
}

.app-notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px 8px;
  border-bottom: 1px solid rgba(217, 227, 238, 0.85);
}

.app-notification-panel-head strong {
  color: #132238;
  font-size: 13px;
  line-height: 1.2;
}

.app-notification-panel-head form {
  margin: 0;
}

.app-notification-panel-head button {
  border: 0;
  background: transparent;
  color: var(--app-brand-blue);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.app-notification-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.app-notification-item {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 227, 238, 0.92);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(249, 252, 255, 0.96), rgba(243, 248, 255, 0.92));
}

.app-notification-item.is-unread {
  border-color: rgba(0, 0, 120, 0.22);
  box-shadow: inset 3px 0 0 rgba(0, 0, 120, 0.9);
}

.app-notification-success {
  background: linear-gradient(180deg, #f4fcf7, #edf9f1);
  border-color: #cce9d5;
}

.app-notification-error {
  background: linear-gradient(180deg, #fff7f7, #fff1f1);
  border-color: #f0c8c8;
}

.app-notification-warning {
  background: linear-gradient(180deg, #fffaf0, #fff4dd);
  border-color: #f3d9a7;
}

.app-notification-copy {
  display: grid;
  gap: 4px;
}

.app-notification-copy strong {
  color: #132238;
  font-size: 13px;
  line-height: 1.35;
}

.app-notification-copy p {
  margin: 0;
  color: #51657f;
  font-size: 12px;
  line-height: 1.45;
}

.app-notification-copy span {
  color: #7a8ca3;
  font-size: 11px;
  line-height: 1.3;
}

.app-notification-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-notification-actions a,
.app-notification-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(217, 227, 238, 0.92);
  background: rgba(255, 255, 255, 0.82);
  color: #1f3a5f;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) var(--motion-ease);
}

.app-notification-actions a:hover,
.app-notification-actions button:hover,
.app-notification-panel-head button:hover {
  color: var(--app-brand-blue);
}

.app-notification-empty {
  padding: 14px 8px 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.app-user-trigger {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px 6px 8px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: rgba(248, 251, 255, 0.92);
  color: #1f3a5f;
  cursor: pointer;
  transition:
    border-color var(--motion-fast) var(--motion-ease),
    background-color var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease);
}

.app-user-trigger::-webkit-details-marker {
  display: none;
}

.app-user-trigger:hover {
  transform: translateY(-1px);
}

.app-user-menu[open] .app-user-trigger {
  border-color: rgba(0, 0, 120, 0.22);
  box-shadow: 0 0 0 4px rgba(0, 0, 120, 0.08);
}

.app-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--app-brand-blue), #1d3ca8);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
  flex: 0 0 28px;
}

.app-user-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app-user-copy {
  display: grid;
  gap: 1px;
  text-align: left;
}

.app-user-copy strong {
  font-size: 13px;
  line-height: 1.2;
}

.app-user-copy span {
  color: #64748b;
  font-size: 11px;
  line-height: 1.2;
}

.app-user-caret {
  color: #64748b;
  font-size: 12px;
}

.app-user-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 10px;
  border: 1px solid rgba(217, 227, 238, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 44px rgba(18, 34, 56, 0.16);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
  overflow: hidden;
}

.app-user-panel-head {
  display: grid;
  gap: 2px;
  padding: 4px 6px 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(217, 227, 238, 0.85);
}

.app-user-panel-head strong {
  color: #132238;
  font-size: 13px;
  line-height: 1.2;
}

.app-user-panel-head span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.app-user-panel a,
.app-user-panel button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #1f3a5f;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  padding: 8px 12px;
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) var(--motion-ease);
}

.app-user-panel a:hover,
.app-user-panel button:hover {
  background: #f4f8ff;
  color: var(--app-brand-blue);
}

.app-user-panel a:focus-visible,
.app-user-panel button:focus-visible,
.app-notification-trigger:focus-visible,
.app-notification-actions a:focus-visible,
.app-notification-actions button:focus-visible,
.app-notification-panel-head button:focus-visible,
.app-user-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 120, 0.10);
}

.app-user-panel form {
  margin: 0;
}

.app-lang-switch {
  display: flex;
  gap: 6px;
}

.app-lang-btn {
  border: 1px solid var(--app-line);
  background: #f8fbff;
  color: #1f3a5f;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease);
}

.app-lang-btn.active {
  background: var(--app-brand-blue);
  border-color: var(--app-brand-blue);
  color: #fff;
}

.app-lang-btn:hover {
  transform: translateY(-1px);
}

.app-lang-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 0, 120, 0.10);
}

.shell,
.wrap,
.top-wrap {
  width: min(var(--app-shell-width), 100%) !important;
  max-width: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.app-site-footer {
  width: min(var(--app-shell-width), 100%);
  margin: 14px auto 0;
  padding: 0 10px 18px;
  color: #5f728d;
  text-align: center;
}

.app-site-footer-main {
  font-size: 13px;
  font-weight: 700;
}

.app-site-footer-legal {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.app-site-footer-links {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.app-site-footer-links a {
  color: #1f3a5f;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition:
    color var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
}

.app-site-footer-links a:hover {
  color: var(--app-brand-blue);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .app-header,
  .app-header-in-shell {
    flex-direction: column;
    align-items: stretch;
  }

  .app-header-actions {
    justify-content: flex-start;
  }
}

.app-messages {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.app-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d6e1ef;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248,251,255,0.98), rgba(241,247,255,0.94));
  color: #1f3a5f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.92);
  transition:
    border-color var(--motion-fast) var(--motion-ease),
    background-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease);
}

.app-alert-body {
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
}

.app-alert-success {
  border-color: #bfe6c9;
  background: linear-gradient(180deg, #f3fcf6, #ecf9f0);
  color: #116634;
}

.app-alert-warning {
  border-color: #f3d9a7;
  background: linear-gradient(180deg, #fffaf0, #fff4dd);
  color: #8a5a00;
}

.app-alert-error {
  border-color: #f0c8c8;
  background: linear-gradient(180deg, #fff7f7, #fff1f1);
  color: #991b1b;
}

.app-alert-info,
.app-alert-debug {
  border-color: #d6e1ef;
  background: linear-gradient(180deg, rgba(248,251,255,0.98), rgba(241,247,255,0.94));
  color: #1f3a5f;
}

.confirm-modal[hidden] {
  display: none;
}

.action-progress-modal[hidden] {
  display: none;
}

.action-progress-modal {
  position: fixed;
  inset: 0;
  z-index: 1190;
}

.action-progress-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 32, 57, 0.34);
  backdrop-filter: blur(5px);
  animation: confirmFadeIn var(--motion-base) var(--motion-ease);
}

.action-progress-panel {
  position: relative;
  width: min(520px, calc(100% - 32px));
  margin: min(16vh, 120px) auto 0;
  padding: 22px;
  border: 1px solid rgba(217, 227, 238, 0.94);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(247,250,255,0.97));
  box-shadow: 0 26px 64px rgba(18, 34, 56, 0.20);
  animation: confirmPopIn var(--motion-slow) var(--motion-ease);
}

.action-progress-kicker {
  margin: 0 0 8px;
  color: #5a6d87;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.action-progress-title {
  margin: 0 0 8px;
  color: #16315b;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.action-progress-copy {
  margin: 0 0 16px;
  color: #5a6d87;
  font-size: 14px;
  line-height: 1.55;
}

.action-progress-track {
  overflow: hidden;
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #dce6f2, #d1dce9);
  box-shadow: inset 0 1px 2px rgba(16, 32, 57, 0.10);
}

.action-progress-bar {
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #000078, #3b70ea);
  box-shadow: 0 0 18px rgba(59, 112, 234, 0.28);
  animation: actionProgressSlide 1.05s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 32, 57, 0.42);
  backdrop-filter: blur(4px);
  animation: confirmFadeIn var(--motion-base) var(--motion-ease);
}

.confirm-dialog {
  position: relative;
  width: min(480px, calc(100% - 32px));
  margin: min(18vh, 120px) auto 0;
  padding: 18px;
  border: 1px solid rgba(217, 227, 238, 0.94);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(247,250,255,0.96));
  box-shadow: 0 24px 56px rgba(18, 34, 56, 0.20);
  animation: confirmPopIn var(--motion-slow) var(--motion-ease);
}

.confirm-dialog-head h2 {
  margin: 0;
  font-size: 20px;
  color: #18345f;
  letter-spacing: -0.02em;
}

.confirm-message {
  margin: 10px 0 0;
  color: #52647a;
  font-size: 14px;
  line-height: 1.55;
}

.confirm-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

body.confirm-open {
  overflow: hidden;
}

@keyframes confirmFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confirmPopIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes actionProgressSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(270%); }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 1ms;
    --motion-base: 1ms;
    --motion-slow: 1ms;
  }
}
