:root {
  --font-body: "Trebuchet MS", Barlow, system-ui, "Segoe UI", sans-serif;
  --font-display: "Trebuchet MS", Barlow, system-ui, "Segoe UI", sans-serif;

  --tip-red: #C4151C;
  --tip-red-dk: #4B1014;
  --white: #FFFFFF;
  --tip-light-grey: #E6E5E5;
  --tip-black: #1C1C1B;
  --tip-charcoal: #434F5B;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 13px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  --page-bg: #E6E5E5;
  --shell-bg: #F5F4F4;
  --chrome-bg: var(--white);
  --card-bg: var(--white);
  --hairline: rgba(28, 28, 27, 0.1);
  --surface-text: var(--tip-black);
  --surface-text-muted: var(--tip-charcoal);
  --muted-label: rgba(28, 28, 27, 0.42);
  --chip-bg: var(--shell-bg);
  --chip-text: var(--tip-black);
  --user-avatar-bg: var(--white);
  --error-bg: linear-gradient(155deg, #FCF4F4, #FBEDED);
  --error-border: #F3DCDC;
  --cancel-text: var(--tip-red-dk);
  --index-url-color: var(--tip-black);
  --tagline-line1-color: var(--tip-black);
  --tagline-line2-color: var(--tip-red);
  --scrollbar-thumb: var(--tip-light-grey);

  --text-main: var(--surface-text);
  --text-muted: var(--surface-text-muted);
  --border-color: var(--hairline);
  --bot-bubble-bg: var(--card-bg);
  --user-bubble-bg: var(--tip-red);
  --signal: var(--tip-red);
  --signal-bg: rgba(196, 21, 28, 0.08);
  --accent-blue: var(--tip-red);
  --error: var(--tip-red);
  --accent-purple: var(--surface-text-muted);
  --batch-group-bg: rgba(28, 28, 27, 0.02);
}

[data-theme="dark"] {
  --tip-red: #FF4D52;
  --tip-red-dk: #D31219;
  --page-bg: #031326;
  --shell-bg: #061B36;
  --chrome-bg: #061B36;
  --card-bg: #0B264A;
  --hairline: rgba(255, 255, 255, 0.16);
  --surface-text: var(--white);
  --surface-text-muted: rgba(255, 255, 255, 0.72);
  --muted-label: rgba(255, 255, 255, 0.55);
  --chip-bg: rgba(255, 255, 255, 0.08);
  --chip-text: var(--white);
  --error-bg: rgba(255, 77, 82, 0.16);
  --error-border: rgba(255, 77, 82, 0.45);
  --cancel-text: var(--white);
  --index-url-color: var(--white);
  --tagline-line1-color: var(--white);
  --tagline-line2-color: #FF4D52;
  --scrollbar-thumb: rgba(255, 255, 255, 0.25);
  --accent-blue: #60A5FA;
  --batch-group-bg: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .btn-ms-logout {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .btn-ms-logout:hover {
  background: rgba(255, 77, 82, 0.25);
  color: var(--white);
  border-color: var(--tip-red);
}

[data-theme="dark"] .btn-lang.selected {
  border-color: #FF4D52;
  background: rgba(255, 77, 82, 0.22);
  box-shadow: 0 0 0 1px #FF4D52 inset;
  color: var(--white);
}

[data-theme="dark"] .dropzone-link {
  color: #FF6B6B;
}

[data-theme="dark"] .custom-select-arrow {
  color: #FF4D52;
}

[data-theme="dark"] .custom-select-option:hover {
  background: rgba(255, 77, 82, 0.15);
  color: #FF6B6B;
}

[data-theme="dark"] .custom-select-option.selected {
  background: rgba(255, 77, 82, 0.25);
  color: #FF6B6B;
}

*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

*::-webkit-scrollbar-button,
*::-webkit-scrollbar-button:single-button,
*::-webkit-scrollbar-button:vertical,
*::-webkit-scrollbar-button:horizontal,
*::-webkit-scrollbar-button:decrement,
*::-webkit-scrollbar-button:increment,
*::-webkit-scrollbar-button:start,
*::-webkit-scrollbar-button:end,
::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-track-piece,
::-webkit-scrollbar-corner {
  background: transparent !important;
}

::-webkit-scrollbar-thumb {
  background: rgba(196, 21, 28, 0.5);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #C4151C;
  border: 1px solid transparent;
  background-clip: padding-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(255, 77, 82, 0.55);
  border: 1px solid transparent;
  background-clip: padding-box;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #FF4D52;
  border: 1px solid transparent;
  background-clip: padding-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 21, 28, 0.5) transparent;
}

[data-theme="dark"] * {
  scrollbar-color: rgba(255, 77, 82, 0.55) transparent;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
}

html,
body {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--page-bg);
  color: var(--surface-text-muted);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page-scroll-wrapper {
  height: calc(100vh - 105px);
  margin-top: 60px;
  margin-bottom: 45px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: rgba(196, 21, 28, 0.16);
}

.header {
  padding: clamp(0.75rem, 1.5vw, 1rem) clamp(1rem, 3vw, 2rem);
  background: var(--chrome-bg);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 100;
  will-change: background-color;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-mark {
  width: clamp(30px, 4vw, 36px);
  height: clamp(30px, 4vw, 36px);
  object-fit: contain;
  flex-shrink: 0;
}

.logo-divider {
  color: var(--hairline);
  font-weight: 400;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
}

#ui-app-title {
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--surface-text);
}

.header-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(0.4rem, 1.2vw, 0.75rem);
}

.auth-controls {
  display: flex;
  align-items: center;
}

.auth-user-wrapper {
  position: relative;
  display: inline-block;
  width: auto;
}

.user-avatar-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--shell-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.user-avatar-button:hover,
#auth-user-container.open .user-avatar-button {
  border-color: var(--tip-red);
  background: rgba(196, 21, 28, 0.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(196, 21, 28, 0.15);
}

.user-profile-card {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 0.85rem;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.95);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#auth-user-container.open .user-profile-card {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.user-profile-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(196, 21, 28, 0.1);
  color: var(--tip-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-profile-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--surface-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-email {
  font-size: 0.76rem;
  color: var(--surface-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-profile-divider {
  height: 1px;
  background: var(--hairline);
  margin: 0.15rem 0;
}

.btn-auth {
  padding: 0.45rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-pill) !important;
  cursor: pointer;
  border: 1px solid var(--hairline);
  transition: all 0.15s ease;
}

.btn-ms-login {
  background: var(--tip-red);
  color: var(--white);
  border-color: var(--tip-red);
}

.btn-ms-login:hover {
  background: var(--tip-red-dk);
  border-color: var(--tip-red-dk);
}

.btn-ms-logout {
  background: rgba(196, 21, 28, 0.08);
  color: var(--tip-red);
  border-color: rgba(196, 21, 28, 0.25);
  margin-left: 0.25rem;
}

.btn-ms-logout:hover {
  background: rgba(196, 21, 28, 0.18);
  border-color: var(--tip-red);
}

.header-lang-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#ui-lang-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem !important;
  font-weight: 700;
  color: var(--muted-label) !important;
}

.custom-select-wrapper {
  position: relative;
  display: inline-block;
  width: 160px;
}

.custom-select-trigger {
  width: 100%;
  box-sizing: border-box;
  background-color: var(--shell-bg);
  color: var(--surface-text);
  border: 1px solid var(--hairline);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill) !important;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.custom-select-trigger:hover {
  border-color: var(--tip-red);
  background-color: rgba(196, 21, 28, 0.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(196, 21, 28, 0.12);
}

.custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--tip-red);
  box-shadow: 0 0 0 3px rgba(196, 21, 28, 0.16);
  transform: translateY(0);
}

.custom-select-arrow {
  color: var(--tip-red);
  font-size: 0.72rem;
  transition: transform 0.22s ease;
}

.custom-select-wrapper.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  padding: 0.35rem;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.96);
  transform-origin: top center;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.custom-select-wrapper.open .custom-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.custom-select-option {
  padding: 0.48rem 0.85rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--surface-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.custom-select-option:hover {
  background: rgba(196, 21, 28, 0.08);
  color: var(--tip-red);
  transform: translateX(2px);
}

.custom-select-option.selected {
  background: rgba(196, 21, 28, 0.14);
  color: var(--tip-red);
  font-weight: 700;
}

.custom-select-option.selected::after {
  content: "✓";
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--tip-red);
}

@keyframes langPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
    border-color: var(--tip-red);
    box-shadow: 0 0 0 4px rgba(196, 21, 28, 0.25);
  }

  100% {
    transform: scale(1);
  }
}

.lang-select-pulse {
  animation: langPulse 0.35s ease-in-out;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.theme-toggle:hover {
  border-color: #F59E0B;
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

[data-theme="dark"] .theme-toggle:hover {
  border-color: var(--tip-red);
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 0 14px rgba(255, 77, 82, 0.45);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--tip-red);
  outline-offset: 2px;
}

.theme-icon-light,
.theme-icon-dark {
  display: inline-block;
  transform-origin: center center;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: inline-block;
}

.theme-toggle.theme-spin .theme-icon-light,
.theme-toggle.theme-spin .theme-icon-dark {
  animation: themeSmoothSpin 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes themeSmoothSpin {
  0% {
    transform: rotate(-180deg) scale(0.35);
    opacity: 0.1;
  }

  65% {
    transform: rotate(12deg) scale(1.18);
    opacity: 1;
  }

  100% {
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

.chat-container {
  width: min(98.5%, 2200px);
  margin: 1.25rem auto 0.75rem;
  padding: clamp(1rem, 2.5vw, 1.75rem) clamp(1rem, 2.5vw, 1.75rem) 1.25rem;
  flex: 1;
  background: var(--shell-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 60px rgba(28, 28, 27, 0.1);
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.login-gateway-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(2rem, 5vw, 4rem) 1.5rem;
  margin: auto;
  max-width: 540px;
  background: var(--bot-bubble-bg);
  border: 1px solid var(--hairline);
  border-left: 4px solid var(--tip-red);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(28, 28, 27, 0.06);
}

.gateway-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.login-gateway-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--surface-text);
  margin-bottom: 0.5rem;
}

.login-gateway-card p {
  font-size: 0.9rem;
  color: var(--surface-text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.btn-gateway-login {
  padding: 0.75rem 1.6rem;
  font-size: 0.95rem;
}

.chat-stream {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.message-row {
  display: flex;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  align-items: flex-start;
  animation: fadeIn 0.25s ease-out forwards;
  width: 100%;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bot-row {
  flex-direction: row;
}

.user-row {
  flex-direction: row-reverse;
}

.avatar {
  width: clamp(32px, 4vw, 38px);
  height: clamp(32px, 4vw, 38px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  flex-shrink: 0;
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 0 1px var(--hairline);
}

.bot-row .avatar {
  background: var(--tip-red);
}

.user-row .avatar {
  background: var(--user-avatar-bg);
}

.message-bubble {
  max-width: min(96%, 1600px);
  padding: clamp(0.9rem, 2vw, 1.15rem) clamp(1rem, 2.5vw, 1.35rem);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--hairline);
  color: var(--surface-text-muted);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.bot-bubble {
  background: var(--bot-bubble-bg);
  border-left-color: var(--tip-red);
}

.user-bubble {
  background: var(--user-bubble-bg);
  border-color: transparent;
  color: var(--white);
}

.error-bubble {
  background: var(--error-bg);
  border-color: var(--error-border);
  border-left-color: var(--tip-red);
}

.message-bubble h3 {
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--surface-text);
}

.user-bubble h3 {
  color: var(--white);
}

.format-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.chip {
  padding: 0.32rem 0.75rem;
  background: var(--chip-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--chip-text);
}

.action-card {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
}

.dropzone {
  width: 100%;
  padding: 1.4rem 1.2rem;
  border: 2px dashed rgba(196, 21, 28, 0.35);
  border-radius: var(--radius-lg);
  background: rgba(196, 21, 28, 0.04);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.dropzone:hover,
.dropzone.drag-active {
  border-color: var(--tip-red);
  background: rgba(196, 21, 28, 0.1);
}

.dropzone.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  border-color: var(--hairline);
  background: var(--chip-bg);
}

.dropzone-icon {
  font-size: 2.1rem;
  animation: pulseIcon 2.5s infinite ease-in-out;
}

@keyframes pulseIcon {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.dropzone-text {
  font-size: 0.92rem;
  color: var(--surface-text);
  font-weight: 500;
  line-height: 1.4;
}

.dropzone-link {
  color: var(--tip-red);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  font-weight: 700;
}

.dropzone-subtext {
  font-size: 0.78rem;
  color: var(--muted-label);
}

.btn-action {
  padding: 0.72rem 1.5rem;
  background: var(--tip-red);
  color: var(--white);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-pill) !important;
  cursor: pointer;
  font-size: clamp(0.82rem, 1.5vw, 0.88rem);
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
}

.btn-action:hover {
  background: var(--tip-red-dk);
}

.btn-action:focus-visible {
  outline: 2px solid var(--tip-red);
  outline-offset: 2px;
}

.btn-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  color: var(--surface-text);
}

.btn-secondary:hover {
  background: rgba(196, 21, 28, 0.08);
  border-color: var(--tip-red);
}

.btn-select-all {
  min-width: 145px;
  justify-content: center;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
}

.btn-lang {
  position: relative;
  padding: 0.65rem 1.1rem 0.65rem 1.85rem;
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill) !important;
  color: var(--surface-text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.22s ease,
    border-color 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease;
  text-align: center;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.btn-lang::before {
  content: "✓";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%) scale(0.6);
  color: var(--tip-red);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn-lang:hover {
  border-color: var(--tip-red);
  background: rgba(196, 21, 28, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(196, 21, 28, 0.15);
}

.btn-lang:focus-visible {
  outline: 2px solid var(--tip-red);
  outline-offset: 2px;
}

.btn-lang.selected {
  border-color: var(--tip-red);
  background: rgba(196, 21, 28, 0.1);
  box-shadow: 0 0 0 1px var(--tip-red) inset;
  font-weight: 700;
}

.btn-lang.selected::before {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--hairline);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 0.7rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--tip-red), var(--tip-red-dk));
  transition: width 0.3s ease;
}

.batch-group {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--batch-group-bg);
}

.batch-dashboard-bubble {
  max-width: 100% !important;
  width: 100%;
}

.file-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.batch-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.85rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.35rem;
}

.file-chips-container::-webkit-scrollbar,
.batch-tasks-list::-webkit-scrollbar {
  width: 6px;
}

.file-chips-container::-webkit-scrollbar-track,
.batch-tasks-list::-webkit-scrollbar-track {
  background: transparent;
}

.file-chips-container::-webkit-scrollbar-thumb,
.batch-tasks-list::-webkit-scrollbar-thumb {
  background: var(--hairline);
  border-radius: 3px;
}

.file-chips-container::-webkit-scrollbar-thumb:hover,
.batch-tasks-list::-webkit-scrollbar-thumb:hover {
  background: var(--tip-red);
}

.batch-task-item {
  padding: 0.85rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--chip-bg);
  transition: all 0.2s ease;
}

.batch-task-item:hover {
  border-color: rgba(196, 21, 28, 0.3);
}

.task-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--hairline);
  color: var(--surface-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.task-badge.badge-running {
  background: rgba(196, 21, 28, 0.12);
  color: var(--tip-red);
}

.task-badge.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.task-badge.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.details-toggle {
  margin-top: 0.75rem;
  background: none;
  border: none;
  color: var(--tip-red);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.details-toggle:hover {
  text-decoration: underline;
}

.details-toggle:focus-visible {
  outline: 2px solid var(--tip-red);
  outline-offset: 2px;
}

.details-panel {
  margin-top: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: var(--chip-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.details-row {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
  color: var(--surface-text);
}

.details-disclaimer {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--surface-text-muted);
  font-style: italic;
}

.progress-percent {
  font-weight: 700;
}

.btn-cancel-job {
  background: rgba(196, 21, 28, 0.12) !important;
  border-color: rgba(196, 21, 28, 0.4) !important;
  color: var(--cancel-text) !important;
}

[data-i18n="expiryNote"] {
  color: var(--surface-text-muted) !important;
}

.tip-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  background: var(--chrome-bg);
  will-change: background-color;
  border-top: 1px solid var(--hairline);
  font-size: 0.72rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tip-index {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--index-url-color);
  letter-spacing: 0.02em;
}

.tip-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--index-url-color);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.18s ease;
}

.footer-logo-mark {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform 0.18s ease, filter 0.18s ease;
}

.tip-footer-link:hover {
  color: var(--tip-red);
  text-decoration: underline;
}

.tip-footer-link:hover .footer-logo-mark {
  transform: scale(1.12);
  filter: drop-shadow(0 0 4px rgba(196, 21, 28, 0.4));
}

.tip-footer-link:focus-visible {
  outline: 2px solid var(--tip-red);
  outline-offset: 2px;
}

.tip-tagline {
  text-align: right;
  line-height: 1.35;
}

.tip-tagline .tagline-line1 {
  display: block;
  font-weight: 400;
  color: var(--tagline-line1-color);
}

.tip-tagline .tagline-line2 {
  display: block;
  font-weight: 700;
  color: var(--tagline-line2-color);
}

@media (max-width: 960px) {
  .message-bubble {
    max-width: 95%;
  }

  .lang-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .user-email-text {
    max-width: 140px;
  }
}

@media (max-width: 680px) {
  .header {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .chat-container {
    margin-top: clamp(7.5rem, 14vh, 9.5rem);
    padding-bottom: 5rem;
  }

  .message-bubble {
    max-width: 98%;
  }

  .lang-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tip-footer {
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
    position: relative;
    margin-top: 2rem;
  }

  .tip-tagline {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {

  .message-row,
  .dropzone-icon,
  .dropzone {
    animation: none !important;
    transition: none !important;
  }

  .header,
  .chat-container,
  .tip-footer {
    transition: none !important;
  }
}