* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg-base: #eef3f8;
  --bg-spot-1: rgba(88, 174, 202, 0.32);
  --bg-spot-2: rgba(65, 128, 189, 0.24);
  --bg-spot-3: rgba(255, 255, 255, 0.72);
  --bg-vignette: rgba(21, 53, 84, 0.1);
  --text-main: #1f4467;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: rgba(255, 255, 255, 0.55);
  --card-shadow: 0 14px 34px rgba(17, 35, 53, 0.14);
  --field-bg: #ffffff;
  --field-border: #5e5e5e;
  --field-text: #1f4467;
  --field-placeholder: #6a7f93;
  --eye-icon: #1f5a84;
  --link-color: #1f5a84;
  --accent-color: #46a7bc;
  --theme-btn-bg: rgba(255, 255, 255, 0.92);
  --theme-btn-border: rgba(31, 68, 103, 0.2);
  --search-bg: #f8fbfd;
  --search-border: #bcc9d6;
  --search-text: #1f4467;
  --search-placeholder: #6a7f93;
  --search-icon-color: #4a5c70;
  --icon-filter: brightness(0) saturate(100%) invert(29%) sepia(27%) saturate(1168%) hue-rotate(168deg) brightness(95%) contrast(92%);
  --icon-fallback-color: #1f5a84;
  --toggle-track: #86cfe7;
  --toggle-track-border: #6eb2ca;
  --toggle-thumb: #f8d75f;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #0d1826;
  --bg-spot-1: rgba(74, 160, 199, 0.24);
  --bg-spot-2: rgba(41, 95, 150, 0.26);
  --bg-spot-3: rgba(16, 36, 58, 0.68);
  --bg-vignette: rgba(0, 0, 0, 0.32);
  --text-main: #e3eef9;
  --card-bg: rgba(19, 33, 50, 0.88);
  --card-border: rgba(122, 168, 215, 0.2);
  --card-shadow: 0 18px 38px rgba(0, 0, 0, 0.35);
  --field-bg: #15263a;
  --field-border: #52708f;
  --field-text: #e3eef9;
  --field-placeholder: #a8bfd7;
  --eye-icon: #9ec5eb;
  --link-color: #74c3df;
  --accent-color: #74c3df;
  --theme-btn-bg: rgba(19, 33, 50, 0.86);
  --theme-btn-border: rgba(122, 168, 215, 0.35);
  --dashboard-title: #d8ebff;
  --dashboard-subtext: #9fc0df;
  --app-card-bg-1: #1a2f45;
  --app-card-bg-2: #15283b;
  --app-card-border: #35516d;
  --app-card-text: #d7e9fb;
  --app-icon-bg: #1f3952;
  --app-icon-border: #3c5f80;
  --icon-filter: brightness(0) saturate(100%) invert(89%) sepia(9%) saturate(709%) hue-rotate(174deg) brightness(103%) contrast(97%);
  --icon-fallback-color: #cbe2f8;
  --search-bg: #16283c;
  --search-border: #3e5d7a;
  --search-text: #e3eef9;
  --search-placeholder: #9db8d4;
  --search-icon-color: #c3dbf2;
  --toggle-track: #21486a;
  --toggle-track-border: #3a6183;
  --toggle-thumb: #dbe9f8;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", sans-serif;
  background: var(--bg-base);
  color: var(--text-main);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background:
    radial-gradient(42rem 24rem at 8% 12%, var(--bg-spot-1), transparent 70%),
    radial-gradient(40rem 26rem at 88% 0%, var(--bg-spot-2), transparent 74%),
    radial-gradient(54rem 32rem at 50% 100%, var(--bg-spot-3), transparent 72%);
}

body::after {
  background:
    linear-gradient(to bottom, transparent 0%, var(--bg-vignette) 100%),
    radial-gradient(80rem 40rem at 50% -10%, rgba(255, 255, 255, 0.08), transparent 70%);
  opacity: 1;
}

.page-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 460px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  border-radius: 18px;
  padding: 32px 24px;
  box-shadow: var(--card-shadow);
}

h1 {
  margin: 0 0 20px;
  text-align: center;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.1;
}

.brand-logo {
  display: block;
  width: min(320px, 90%);
  height: auto;
  margin: 0 auto 18px;
}

body[data-theme="dark"] .brand-logo,
body[data-theme="dark"] .platform-logo {
  filter: brightness(2) contrast(1.12) saturate(1.08);
}

.accent {
  color: var(--accent-color);
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

form button[type="submit"] {
  margin-top: 10px;
  margin-bottom: 20px;
}

label {
  font-size: 0.95rem;
  font-weight: 600;
}

input {
  width: 100%;
  border: 2px solid var(--field-border);
  background: var(--field-bg);
  color: var(--field-text);
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 1rem;
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: #46a7bc;
}

input::placeholder {
  color: var(--field-placeholder);
  opacity: 1;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 48px;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--eye-icon);
  border-radius: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.18s ease;
}

.toggle-password svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toggle-password .eye-off {
  display: none;
}

.toggle-password.is-visible .eye-on {
  display: none;
}

.toggle-password.is-visible .eye-off {
  display: block;
}

.toggle-password:hover {
  background: transparent;
  color: #194b6f;
  box-shadow: none;
  transform: translateY(-50%);
  filter: none;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2f7aad 0%, #1f5a84 58%, #174567 100%);
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 10px 20px rgba(31, 90, 132, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 24px rgba(31, 90, 132, 0.34);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 7px 14px rgba(31, 90, 132, 0.28);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}

.text-link {
  margin-top: 14px;
  text-align: center;
  font-weight: 600;
}

.text-link a {
  color: var(--link-color);
}

.link-button {
  border: none;
  background: transparent;
  color: var(--link-color);
  padding: 0;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.18s ease;
}

.link-button:hover {
  background: transparent;
  color: var(--link-color);
  filter: brightness(1.08);
  box-shadow: none;
  transform: none;
}

.link-button:active {
  box-shadow: none;
  transform: none;
}

.link-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.message {
  min-height: 1.2em;
  margin: 4px 0 0;
  font-size: 0.95rem;
  text-align: center;
}

.message.error {
  color: #b3261e;
}

.message.success {
  color: #176b2f;
}

.caps-warning {
  margin: -4px 2px 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #ca1d1d;
}

body[data-theme="dark"] .caps-warning {
  color: #ffbf66;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--theme-btn-border);
  background: var(--theme-btn-bg);
  color: var(--text-main);
  padding: 0;
  box-shadow: 0 10px 24px rgba(17, 35, 53, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: box-shadow 0.22s ease, filter 0.22s ease;
}

.theme-toggle::before {
  content: "\263E";
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-main);
  opacity: 0.95;
}

.theme-toggle-thumb {
  display: none;
}

.theme-toggle:hover {
  filter: brightness(1.03);
  box-shadow: 0 12px 26px rgba(17, 35, 53, 0.24);
}

.theme-toggle[data-mode="dark"]::before {
  content: "\2600";
}

.theme-toggle:focus-visible {
  outline: 2px solid #8fd9ff;
  outline-offset: 3px;
}

body[data-theme="dark"] .theme-toggle {
  background: var(--theme-btn-bg);
}

@media (max-width: 560px) {
  .theme-toggle {
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
  }

  .theme-toggle::before {
    font-size: 1rem;
  }
}

.toast-container {
  position: fixed;
  top: 72px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 40;
  width: min(360px, calc(100% - 32px));
}

.toast {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
  border-radius: 12px;
  padding: 12px 10px 14px 14px;
  font-size: 0.92rem;
  line-height: 1.35;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
  border: 1px solid transparent;
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.hide {
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
}

.toast-text {
  margin: 0;
  padding-right: 4px;
}

.toast-close {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  box-shadow: none;
  transform: none;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: none;
  transform: none;
  filter: none;
}

.toast-progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  transform-origin: left;
  animation: toast-timer 4.2s linear forwards;
}

.toast-success {
  background: rgba(23, 107, 47, 0.95);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
}

.toast-error {
  background: rgba(179, 38, 30, 0.95);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
}

@keyframes toast-timer {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (max-width: 560px) {
  .toast-container {
    top: 64px;
    right: 10px;
    width: calc(100% - 20px);
  }
}

.dashboard {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.dashboard-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.dashboard h1 {
  text-align: left;
  margin-bottom: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.tool-card {
  background: #d5dae0;
  border-radius: 14px;
  padding: 22px 18px;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #1f4467;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
}

.tool-card:hover {
  border-color: #1f5a84;
}

@media (max-width: 640px) {
  .dashboard-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

.platform-dashboard {
  max-width: 1220px;
  margin: 0 auto;
  padding: 52px 34px 52px;
}

.platform-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand-search {
  display: flex;
  align-items: center;
  gap: 16px;
}

.platform-logo {
  width: min(220px, 44vw);
  height: auto;
}

.search-wrap {
  display: flex;
  align-items: center;
  width: 230px;
  border: 1px solid var(--search-border);
  border-radius: 10px;
  background: var(--search-bg);
  padding: 0 10px;
  box-shadow: 0 3px 10px rgba(31, 68, 103, 0.06);
}

.search-icon {
  width: 24px;
  height: 24px;
  color: var(--search-icon-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-wrap input {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--search-text);
  height: 44px;
  padding: 0 8px;
}

.search-wrap input::placeholder {
  color: var(--search-placeholder);
  opacity: 1;
}

.search-wrap input:focus {
  border: 0;
}

.logout-btn {
  border-radius: 12px;
  padding: 11px 18px;
  min-width: 96px;
  box-shadow: 0 10px 20px rgba(31, 90, 132, 0.28);
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.platform-title {
  margin: 52px 0 20px;
  text-align: center;
  color: var(--dashboard-title, #23557d);
  letter-spacing: 0.6px;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.welcome-text {
  white-space: nowrap;
  margin: 0;
  color: var(--dashboard-subtext, #2b5c86);
  font-size: 0.9rem;
}

.apps-slider {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 70px;
  align-items: center;
  gap: 22px;
  margin-top: 32px;
}

.nav-arrow {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
  color: #ffffff;
  background: linear-gradient(135deg, #5bbce9 0%, #46a7bc 100%);
  padding: 0;
  box-shadow: 0 12px 22px rgba(31, 90, 132, 0.28);
}

.nav-arrow:hover {
  background: linear-gradient(135deg, #62c3ee 0%, #49b0c8 100%);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 16px 26px rgba(31, 90, 132, 0.34);
}

.nav-arrow:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 22px;
  min-height: 372px;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  min-height: 176px;
  background: linear-gradient(145deg, var(--app-card-bg-1, #ffffff) 0%, var(--app-card-bg-2, #eef4f9) 100%);
  color: var(--app-card-text, #153f60);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  border: 1px solid var(--app-card-border, #d3e0ec);
  border-radius: 14px;
  transition: border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 8px 20px rgba(31, 68, 103, 0.08);
}

.app-card:hover {
  border-color: #5a9ac8;
  transform: translateY(-4px);
  box-shadow: 0 16px 28px rgba(31, 68, 103, 0.2);
}

.app-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--app-icon-bg, #fff);
  border: 1px solid var(--app-icon-border, #d7e4ef);
  box-shadow: 0 6px 14px rgba(31, 68, 103, 0.14);
}

.app-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: var(--icon-filter, brightness(0) saturate(100%) invert(29%) sepia(27%) saturate(1168%) hue-rotate(168deg) brightness(95%) contrast(92%));
}

.app-icon.fallback {
  color: var(--icon-fallback-color);
  font-weight: 700;
}

.app-name {
  text-align: center;
  line-height: 1.2;
}

.app-card.is-disabled {
  opacity: 0.82;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: #2b5c86;
  font-weight: 600;
  padding-top: 42px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 42px 0 0;
}

.page-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #afc3d6;
  background: linear-gradient(180deg, #ffffff 0%, #edf4fa 100%);
  color: #1f4467;
  font-weight: 600;
  padding: 0;
  box-shadow: 0 6px 12px rgba(31, 68, 103, 0.12);
}

.page-btn:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e1edf8 100%);
  color: #1f4467;
}

.page-btn.is-active {
  background: linear-gradient(135deg, #2f7aad 0%, #1f5a84 58%, #174567 100%);
  color: #fff;
  border-color: #1f5a84;
  box-shadow: 0 10px 18px rgba(31, 90, 132, 0.35);
}

@media (max-width: 900px) {
  .platform-dashboard {
    padding: 36px 18px 34px;
  }

  .platform-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand-search {
    width: 100%;
    justify-content: space-between;
  }

  .search-wrap {
    width: min(240px, 52vw);
  }

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

  .apps-slider {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 14px;
  }

  .nav-arrow {
    width: 52px;
    height: 52px;
    font-size: 1.6rem;
    align-self: center;
    justify-self: center;
  }

  .apps-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    min-height: 0;
    gap: 16px;
  }

  .welcome-text {
    text-align: right;
  }

  .platform-title {
    margin-top: 36px;
  }
}

@media (max-width: 560px) {
  .apps-grid {
    grid-template-columns: 1fr;
  }

  .app-card {
    min-height: 132px;
  }
}