/* ── FORCE LTR ALWAYS ──────────────────────────────────────
   Remove any RTL that may have been cached from previous
   versions of the app.
*/
html, body {
  direction: ltr !important;
  text-align: left !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

/* ── BASE ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

img, svg, canvas, video {
  max-width: 100%;
}

button, a, input, select, textarea {
  touch-action: manipulation;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Page fade-in on navigation */
main {
  animation: fadeIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c2925; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #3e3a34; }

/* ── FOCUS RINGS ───────────────────────────────────────── */
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 1px #10b981;
  border-color: #10b981 !important;
}

/* ── FIELD INPUT UTILITY ───────────────────────────────── */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="date"],
textarea,
select {
  background-color: #12110f !important;
  background: #12110f !important;
  color: #efe9de !important;
  border-color: #2c2925 !important;
  -webkit-text-fill-color: #efe9de !important;
  border-radius: 0.5rem !important;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="email"]::placeholder,
input[type="tel"]::placeholder,
input[type="password"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
  color: #6b655c !important;
  -webkit-text-fill-color: #6b655c !important;
  opacity: 1 !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #12110f inset !important;
  -webkit-text-fill-color: #efe9de !important;
  caret-color: #34d399;
  border-color: #2c2925 !important;
}

/* .field-input class */
.field-input {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  background-color: #12110f !important;
  background: #12110f !important;
  color: #efe9de !important;
  -webkit-text-fill-color: #efe9de !important;
  border: 1px solid #2c2925 !important;
  border-radius: 0.5rem !important;
  outline: none;
  transition: border-color 0.15s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.15s cubic-bezier(0.22, 1, 0.36, 1);
  -webkit-appearance: none;
  appearance: none;
  caret-color: #34d399;
}

.field-input::placeholder {
  color: #6b655c !important;
  -webkit-text-fill-color: #6b655c !important;
  opacity: 1 !important;
}

.field-input:focus,
.field-input:focus-visible,
.field-input:focus-within {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 1px #10b981 !important;
  outline: none !important;
  background-color: #12110f !important;
}

/* Remove number spinners */
.field-input::-webkit-outer-spin-button,
.field-input::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field-input[type="number"],
input[type="number"].field-input { -moz-appearance: textfield; }

/* ── NUMBER INPUTS always LTR ──────────────────────────── */
input[type="number"],
input[type="tel"],
input[type="email"] {
  direction: ltr !important;
  text-align: left !important;
}

/* ── ANIMATED TYPING DOTS (chatbot) ────────────────────── */
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%            { transform: translateY(-4px); }
}
.typing-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8a847a;
  animation: bounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.30s; }

/* ── SMOOTH TRANSITIONS ────────────────────────────────── */
a, button {
  transition: color 0.15s cubic-bezier(0.22, 1, 0.36, 1),
              background-color 0.15s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.15s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.15s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 640px) {
  main {
    scroll-padding-bottom: 1rem;
  }

  .field-input,
  select,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  input[type="date"],
  textarea {
    font-size: 16px !important;
  }

  .mobile-history-table,
  .mobile-history-table thead,
  .mobile-history-table tbody,
  .mobile-history-table tr,
  .mobile-history-table td {
    display: block;
    width: 100%;
  }

  .mobile-history-table thead {
    display: none;
  }

  .mobile-history-table tbody {
    background: transparent;
  }

  .mobile-history-table tr {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #2c2925;
  }

  .mobile-history-table tr:last-child {
    border-bottom: 0;
  }

  .mobile-history-table td {
    padding: 0.35rem 0 !important;
    white-space: normal;
  }

  .mobile-history-table td[data-label] {
    display: grid;
    grid-template-columns: minmax(4.5rem, 35%) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
  }

  .mobile-history-table td[data-label]::before {
    content: attr(data-label);
    color: #8a847a;
    font-size: 0.75rem;
    font-weight: 500;
  }

  .mobile-history-table td[data-label="Action"] {
    align-items: start;
  }

  .mobile-history-table td[data-label="Action"] > * {
    justify-self: start;
  }

  .mobile-history-table .mobile-history-empty {
    padding: 0;
  }

  .mobile-history-table .mobile-history-empty td {
    display: block;
    padding: 1.5rem 1rem !important;
  }
}

/* ── SELECT DROPDOWNS ──────────────────────────────────── */
select {
  border-radius: 0.5rem !important;
  border: 1px solid #2c2925 !important;
  padding: 0.25rem 0.75rem;
  cursor: pointer;
}

/* ── RANGE SLIDER ──────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 9999px !important;
  background: #2c2925;
  outline: none;
  border: none !important;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #34d399;
  cursor: pointer;
  border: 2px solid #161513;
  transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #34d399;
  cursor: pointer;
  border: 2px solid #161513;
}
