:root {
  --color-primary: #0c2a44;
  --dark-blue: #06192a;
  --green-blue: #114864;
  --cyan: #00a1ab;
  --black: #000000;
  --gray: #353535;
  --light-gray: #e8e8e8;
  --light-gray2: #e7ecee;
  --blue-gray: #c4d1dc;
  --blue-gray2: #eef2f5;
  --text-gray: #c5d1d8;
  --white: #fff;

  --bg-color: #eef2f5;

  /* COLORS THAT DONT CHANGE ON DARKMODE */
  --bg-white: #fff;
  --enable-primary: #0c2a44;
  --green-assigned: #44e27d;
  --gray-unassigned: #a4a4a2;
  --blue-used: #3d98c4;

  /* NAV BAR COLORS - Stay unchanged in dark mode */
  --color-primary-nav: #0c2a44;
  --dark-blue-nav: #06192a;
  --green-blue-nav: #114864;
  --cyan-nav: #00a1ab;
  --black-nav: #000000;
  --gray-nav: #353535;
  --light-gray-nav: #e8e8e8;
  --light-gray2-nav: #e7ecee;
  --blue-gray-nav: #c4d1dc;
  --white-nav: #fff;
  --border-nav: #0c2a44;

  /* Suite workspace window chrome (Map Editor / Monitoring / Data Analysis) */
  --suite-window-bg: rgba(255, 255, 255, 0.75);
  --suite-window-border: rgba(148, 163, 184, 0.45);
  --suite-window-border-soft: rgba(148, 163, 184, 0.2);

  /* Semantic workspace colors. Keep feature UI on the suite palette while
   * giving surfaces, text, and interaction states predictable contrast. */
  --suite-surface-page: #eef2f5;
  --suite-surface-panel: #ffffff;
  --suite-surface-section: #f1f5f9;
  --suite-surface-control: #ffffff;
  --suite-border-default: #8798aa;
  --suite-border-strong: #718096;
  --suite-text-primary: #172033;
  --suite-text-secondary: #475569;
  --suite-text-muted: #64748b;
  --suite-text-disabled: #7b8794;
  --suite-state-hover: rgba(12, 42, 68, 0.07);
  --suite-state-selected: rgba(0, 161, 171, 0.18);
  --suite-state-selected-strong: rgba(0, 161, 171, 0.3);
  --suite-focus-ring: #007f87;
  --suite-danger: #b42318;
  --suite-danger-border: #dc8b83;
  --suite-disabled-bg: #e7ecee;
  /* Shared horizontal inset: header, page wrapper, Map Editor chrome. */
  --suite-shell-inline-pad: 0.5rem;
  /* Shared content column; sized to fill a 16:9 1440p viewport (2560px). */
  --suite-shell-max-width: 160rem;
  /* Fixed viewport-corner maximize/restore control. */
  --suite-maximize-size: 2.5rem;
  --suite-maximize-inset: 2px;
  --suite-maximize-slot: calc(var(--suite-maximize-inset) + var(--suite-maximize-size));

  /* Dialog chrome. Outline buttons only. */
  --dialog-radius: 6px;
  --dialog-button-radius: 6px;
  --dialog-border-color: rgba(148, 163, 184, 0.95);
  --dialog-bg: white;
  --dialog-fg: #0f172a;
  --dialog-muted: #64748b;
  --dialog-placeholder: #94a3b8;
  --dialog-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  --dialog-overlay: rgba(15, 23, 42, 0.46);
  --dialog-button-hover-bg: rgba(226, 232, 240, 0.95);
  --dialog-danger: #dc2626;
  --dialog-danger-hover-bg: #fef2f2;
  --dialog-danger-hover-fg: #b91c1c;
  --dialog-warning: #b45309;
  --dialog-warning-hover-bg: #fffbeb;
  --dialog-warning-hover-fg: #92400e;
  --dialog-success: #15803d;
  --dialog-success-hover-bg: #f0fdf4;
  --dialog-success-hover-fg: #166534;

  /* Toast chrome. Neutral by default; semantic colors are accents only. */
  --toast-width: 26.25rem;
  --toast-radius: 0.75rem;
  --toast-border-color: rgb(203 213 225);
  --toast-bg: rgb(255 255 255 / 0.95);
  --toast-fg: rgb(15 23 42);
  --toast-muted: rgb(71 85 105);
  --toast-shadow: 0 20px 25px -5px rgb(15 23 42 / 0.18),
    0 8px 10px -6px rgb(15 23 42 / 0.12);
  --toast-info: rgb(56 189 248);
  --toast-success: rgb(52 211 153);
  --toast-warning: rgb(251 191 36);
  --toast-error: rgb(251 113 133);
  --toast-dismiss-fg: rgb(100 116 139);
  --toast-dismiss-hover-bg: rgb(241 245 249);
  --toast-dismiss-hover-fg: rgb(51 65 85);
  --toast-viewport-inline-offset: 1.5rem;
  --toast-viewport-bottom-offset: 1.5rem;
  --toast-mobile-offset: 1rem;
}

/*
 * Top-row slot for the maximize control (end) and maximized hamburger (start).
 * Do not pad `main` — only chrome rows / landing first blocks so canvases stay full width.
 * Datalog + Map Editor pickers share `.datalog-browse`; pad its first child
 * (title / header-row), not search or the list.
 */
main.main--maximized .datalog-browse > :first-child,
main.main--maximized .datalog-header-row,
main.main--maximized .monitoring-header-row,
main.main--maximized .map-editor-compact-chrome,
main.main--maximized .map-editor-standard-chrome__toolbar,
main.main--maximized .map-definitions-shell > :first-child,
main.main--maximized .license-page-toolbar,
main.main--maximized .tool-grid,
main.main--maximized .page-intro,
main.main--maximized .statistics-filters,
main.main--maximized .tl-banner,
main.main--maximized .upload-stepper,
main.main--maximized .home > .hero .hero-inner {
  box-sizing: border-box;
  padding-inline: var(--suite-maximize-slot);
}

/* Cards already have inline pad; only add leftover slot on the outer edges. */
main.main--maximized .home > .dashboard:first-child > .row:first-child {
  --suite-maximize-card-edge: max(
    0px,
    calc(
      var(--suite-maximize-slot) - var(--suite-shell-inline-pad, 0.5rem) -
        var(--dash-card-pad-inline, 1.25rem)
    )
  );
}

main.main--maximized .home > .dashboard:first-child > .row:first-child > :first-child .card-header,
main.main--maximized .home > .dashboard:first-child > .row:first-child > :first-child.shortcut {
  box-sizing: border-box;
  padding-inline-start: var(--suite-maximize-card-edge);
}

main.main--maximized .home > .dashboard:first-child > .row:first-child > :last-child .card-header,
main.main--maximized .home > .dashboard:first-child > .row:first-child > :last-child.shortcut {
  box-sizing: border-box;
  padding-inline-end: var(--suite-maximize-card-edge);
}

/* Shrink-wrapped card: padding would only inset labels, not clear the corners. */
main.main--maximized .version-list {
  margin-inline: var(--suite-maximize-slot);
}

/* ROOT COLORS SWITCH WHEN DARK MODE - Softer dark theme */
[data-theme='dark'] {
  /* Text colors - lighter for readability */
  --color-primary: #e8e8e8;
  --black: #e8e8e8;
  --gray: #b0b8c0;
  --text-gray: #9ca3af;

  /* Background colors - softer dark grays/blues, closer to sidebar */
  --bg-color: #0f1a26;
  --light-gray: #1a2535;
  --light-gray2: #152030;
  --blue-gray: #2a3545;
  --blue-gray2: #1f2a3a;

  /* Accent colors - keep cyan, adjust others */
  --cyan: #00a1ab;
  --green-blue: #5a7a8a;
  --dark-blue: #06192a;

  /* White becomes dark background equivalent */
  --white: #1a1f2e;

  /* Suite workspace window chrome */
  --suite-window-bg: rgba(226, 232, 240, 0.05);
  --suite-window-border: rgba(255, 255, 255, 0.1);
  --suite-window-border-soft: rgba(255, 255, 255, 0.08);

  /* Dialog chrome */
  --dialog-border-color: rgba(255, 255, 255, 0.28);
  --dialog-bg: var(--bg-color);
  --dialog-fg: white;
  --dialog-muted: var(--gray);
  --dialog-placeholder: #8b9aab;
  --dialog-button-hover-bg: rgba(255, 255, 255, 0.1);
  --dialog-danger: #f87171;
  --dialog-danger-hover-bg: rgba(239, 68, 68, 0.15);
  --dialog-danger-hover-fg: #fecaca;
  --dialog-warning: #fbbf24;
  --dialog-warning-hover-bg: rgba(245, 158, 11, 0.15);
  --dialog-warning-hover-fg: #fde68a;
  --dialog-success: #4ade80;
  --dialog-success-hover-bg: rgba(34, 197, 94, 0.15);
  --dialog-success-hover-fg: #bbf7d0;

  /* Toast chrome */
  --toast-border-color: rgb(255 255 255 / 0.1);
  --toast-bg: rgb(15 26 38 / 0.9);
  --toast-fg: rgb(255 255 255);
  --toast-muted: rgb(203 213 225 / 0.86);
  --toast-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.36),
    0 8px 10px -6px rgb(0 0 0 / 0.24);
  --toast-dismiss-fg: rgb(226 232 240 / 0.65);
  --toast-dismiss-hover-bg: rgb(255 255 255 / 0.06);
  --toast-dismiss-hover-fg: rgb(226 232 240);

  --suite-surface-page: #0f1a26;
  --suite-surface-panel: #172332;
  --suite-surface-section: #1d2b3b;
  --suite-surface-control: #101b29;
  --suite-border-default: #5b6c80;
  --suite-border-strong: #718096;
  --suite-text-primary: #e7edf3;
  --suite-text-secondary: #c0cad5;
  --suite-text-muted: #9baabd;
  --suite-text-disabled: #78879a;
  --suite-state-hover: rgba(148, 163, 184, 0.13);
  --suite-state-selected: rgba(0, 161, 171, 0.26);
  --suite-state-selected-strong: rgba(0, 161, 171, 0.4);
  --suite-focus-ring: #2dd4da;
  --suite-danger: #fca5a5;
  --suite-danger-border: #a65353;
  --suite-disabled-bg: #1a2535;
}

/* Input text color adapts to theme */
input {
  color: var(--black);
  background-color: var(--white);
}

[data-theme='dark'] input {
  color: var(--black);
  background-color: var(--light-gray);
}

  .login-section.svelte-1x05zx6 {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
  }

  .background-gradient.svelte-1x05zx6 {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
      135deg,
      var(--bg-color) 0%,
      var(--light-gray2) 50%,
      var(--bg-color) 100%
    );
    z-index: 0;
  }

  [data-theme='dark'] .background-gradient.svelte-1x05zx6 {
    background: linear-gradient(
      135deg,
      var(--bg-color) 0%,
      var(--light-gray) 30%,
      var(--bg-color) 100%
    );
  }

  .content.svelte-1x05zx6 {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .login-card.svelte-1x05zx6 {
    width: 100%;
    background-color: var(--white);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }

  [data-theme='dark'] .login-card.svelte-1x05zx6 {
    background-color: var(--light-gray);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--blue-gray);
  }

  .logo-container.svelte-1x05zx6 {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
  }

  .logo.svelte-1x05zx6 {
    height: auto;
    max-width: 200px;
    width: 100%;
    transition: transform 0.3s ease;
  }

  .logo.svelte-1x05zx6:hover {
    transform: scale(1.02);
  }

  .login-title.svelte-1x05zx6 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--black);
    text-align: center;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
  }

  .login-subtitle.svelte-1x05zx6 {
    font-size: 0.95rem;
    color: var(--gray);
    text-align: center;
    margin: 0 0 2rem 0;
  }

  form.svelte-1x05zx6 {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
  }

  .input-group.svelte-1x05zx6 {
    position: relative;
    width: 100%;
  }

  .form-input.svelte-1x05zx6 {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--cyan);
    border-radius: 12px;
    color: var(--black);
    background-color: var(--bg-white);
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
  }

  [data-theme='dark'] .form-input.svelte-1x05zx6 {
    background-color: var(--light-gray2);
    border-color: var(--blue-gray);
    color: #ffffff;
  }

  .form-input.svelte-1x05zx6:focus {
    outline: none;
    border-color: var(--green-blue);
    box-shadow: 0 0 0 3px rgba(17, 72, 100, 0.1);
  }

  [data-theme='dark'] .form-input.svelte-1x05zx6:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 161, 171, 0.2);
  }

  .form-input.svelte-1x05zx6::-moz-placeholder {
    color: var(--gray);
  }

  .form-input.svelte-1x05zx6::placeholder {
    color: var(--gray);
  }

  .forgot-password.svelte-1x05zx6 {
    align-self: flex-start;
    margin-top: -0.5rem;
    font-size: 0.9rem;
    color: var(--cyan);
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }

  .forgot-password.svelte-1x05zx6:hover {
    color: #008a93;
  }

  [data-theme='dark'] .forgot-password.svelte-1x05zx6 {
    color: #5ecdd4;
  }

  [data-theme='dark'] .forgot-password.svelte-1x05zx6:hover {
    color: #8ae0e6;
  }

  .error-container.svelte-1x05zx6 {
    padding: 0.75rem 1rem;
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    animation: svelte-1x05zx6-slideIn 0.3s ease;
  }

  [data-theme='dark'] .error-container.svelte-1x05zx6 {
    background-color: rgba(220, 53, 69, 0.15);
    border-color: rgba(220, 53, 69, 0.4);
  }

  @keyframes svelte-1x05zx6-slideIn {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .error-message.svelte-1x05zx6 {
    color: #dc3545;
    font-weight: 500;
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
  }

  [data-theme='dark'] .error-message.svelte-1x05zx6 {
    color: #ff6b7a;
  }

  .submit-button.svelte-1x05zx6 {
    width: 100%;
    background: linear-gradient(135deg, var(--green-blue) 0%, var(--cyan) 100%);
    color: var(--white);
    border: none;
    border-radius: 12px;
    padding: 0.875rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(17, 72, 100, 0.3);
    position: relative;
    overflow: hidden;
  }

  .submit-button.svelte-1x05zx6::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
  }

  .submit-button.svelte-1x05zx6:hover::before {
    left: 100%;
  }

  .submit-button.svelte-1x05zx6:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 72, 100, 0.4);
  }

  .submit-button.svelte-1x05zx6:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(17, 72, 100, 0.3);
  }

  .submit-button.svelte-1x05zx6 span:where(.svelte-1x05zx6) {
    position: relative;
    z-index: 1;
  }

  @media (min-width: 600px) {
    .login-card.svelte-1x05zx6 {
      padding: 3.5rem 3rem;
    }

    .login-title.svelte-1x05zx6 {
      font-size: 2.25rem;
    }
  }

  @media (max-width: 480px) {
    .login-section.svelte-1x05zx6 {
      padding: 1rem;
    }

    .login-card.svelte-1x05zx6 {
      padding: 2rem 1.5rem;
      border-radius: 20px;
    }

    .logo.svelte-1x05zx6 {
      max-width: 160px;
    }

    .login-title.svelte-1x05zx6 {
      font-size: 1.75rem;
    }
  }

  /* Keep in sync with SUITE_SHORT_LANDSCAPE_MEDIA in $lib/ui/responsive.ts. */
  @media (orientation: landscape) and (max-width: 1024px) and (max-height: 500px) {
    .login-section.svelte-1x05zx6 {
      box-sizing: border-box;
      height: 100vh;
      height: 100dvh;
      min-height: 0;
      align-items: flex-start;
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior-y: contain;
    }

    .background-gradient.svelte-1x05zx6 {
      position: fixed;
      inset: 0;
    }

    .content.svelte-1x05zx6 {
      margin-block: auto;
    }
  }
