/* ==========================================================================
   base.css — tokens, reset, typography and the small building blocks
   (buttons, chips, segmented control, switches, inputs, badges).
   Colours come from themes.css.

   Sizes are in rem (1rem = 16px at full size). The root font-size below
   scales the whole interface at once — change one number to make the app
   bigger or smaller on a screen size. Hairlines and blur stay in px.
   ========================================================================== */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --r-xl: 2.5rem;
  --r-lg: 1.625rem;
  --r-md: 1.125rem;
  --r-sm: .8125rem;

  /* every button shares one height so rows always line up */
  --h-btn: 2.875rem;
  --h-btn-sm: 2.375rem;
  --gap: 1.25rem;
  --rail-w: 4.25rem;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* fallbacks before theme.js runs */
  --accent: #0e7c6d;
  --on-accent: #fff;
  --ink: #121417;
  --muted: rgb(18 20 23 / 0.8);
  --chrome-ink: #ffffff;
  --chrome-dim: rgb(255 255 255 / 0.9);
  --chrome-hover: rgb(255 255 255 / 0.18);
}

/* ---------------------------------------------------------------- reset -- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: #cbbba3;
  font-size: 16px; /* phones: full size */
}
/* tablets and laptops: the whole UI at 85%, so more fits without scrolling */
@media (min-width: 761px) {
  html {
    font-size: 13.6px;
  }
}
/* big monitors have room to spare — a little larger again */
@media (min-width: 1800px) {
  html {
    font-size: 14.4px;
  }
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--base1, #cbbba3);
  color: var(--ink);
  font-family: var(--font);
  font-size: .875rem;
  line-height: 1.45;
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.locked {
  overflow: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
img {
  display: block;
  max-width: 100%;
}
svg {
  flex-shrink: 0;
}
input,
textarea {
  outline: none;
}
input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
:focus-visible {
  outline: .125rem solid var(--accent);
  outline-offset: .1875rem;
}
input:focus-visible {
  outline: none;
}
::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}
.pos {
  color: var(--green);
}
.neg {
  color: var(--red);
}

/* -------------------------------------------------------------- motion -- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(.875rem);
    filter: blur(6px);
  }
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 .5rem transparent;
  }
}
@keyframes flash {
  0% {
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 90%, transparent), 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  }
  100% {
    box-shadow: inset 0 0 0 1.5px transparent, 0 0 0 1.125rem transparent;
  }
}

[data-motion='reduced'] *,
[data-motion='reduced'] *::before,
[data-motion='reduced'] *::after {
  animation-duration: 0.01ms !important;
  animation-delay: 0ms !important;
  transition-duration: 0.01ms !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: var(--h-btn);
  padding: 0 1.25rem;
  border-radius: 62.4375rem;
  background: var(--soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgb(255 255 255 / 0.25);
  font-size: .9062rem;
  font-weight: 500;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform 0.3s var(--spring),
    background-color 0.25s,
    color 0.25s,
    box-shadow 0.25s,
    opacity 0.25s;
}
.btn:hover {
  background: var(--soft-2);
}
.btn:active {
  transform: scale(0.96);
}
.btn.solid {
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: 0 .625rem 1.5rem -.875rem rgb(0 0 0 / 0.55);
}
.btn.solid:hover {
  transform: translateY(-1px);
  box-shadow: 0 .875rem 1.75rem -.875rem rgb(0 0 0 / 0.6);
}
.btn.danger {
  color: var(--red);
}
.btn.danger:hover {
  background: var(--red-bg);
}
.btn:disabled {
  opacity: 0.55;
  transform: none;
}
.btn.sm {
  height: var(--h-btn-sm);
  padding: 0 .875rem;
  font-size: .8438rem;
}
/* loading state: label fades, a ring spins in its place */
.btn.busy {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.busy::after {
  content: '';
  position: absolute;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  border: .125rem solid var(--on-solid);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* rows/grids of equal buttons */
.btn-grid {
  display: grid;
  gap: .625rem;
}
.btn-grid.two {
  grid-template-columns: 1fr 1fr;
}
.btn-grid .btn {
  width: 100%;
  min-width: 0;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--ink-2);
  transition:
    background-color 0.2s,
    transform 0.3s var(--spring);
}
.icon-btn:hover {
  background: var(--soft);
}
.icon-btn:active {
  transform: scale(0.9);
}
.icon-btn.soft {
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
}
.icon-btn.soft:hover {
  background: var(--soft-2);
}

/* --------------------------------------------------------------- chips -- */
.chips {
  display: grid;
  gap: .5rem;
}
.chips.c-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.chips.c-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.chip {
  height: 2.5rem;
  padding: 0 .625rem;
  border-radius: 62.4375rem;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: .8438rem;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    background-color 0.25s,
    color 0.25s,
    box-shadow 0.25s,
    transform 0.3s var(--spring);
}
.chip:hover {
  background: var(--soft-2);
}
.chip:active {
  transform: scale(0.94);
}
.chip.on {
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: 0 .5rem 1.125rem -.75rem rgb(0 0 0 / 0.5);
}

/* ---------------------------------------------------- segmented control -- */
.seg {
  position: relative;
  display: inline-flex;
  padding: .25rem;
  gap: .125rem;
  border-radius: 62.4375rem;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg.fill {
  display: flex;
  width: 100%;
}
.seg.fill button {
  flex: 1 1 0;
}
.seg button {
  position: relative;
  z-index: 1;
  height: 2.375rem;
  padding: 0 .875rem;
  border-radius: 62.4375rem;
  font-size: .8438rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4375rem;
  transition: color 0.3s;
}
.seg button:hover,
.seg button.on {
  color: var(--ink);
}
.seg button.on {
  color: var(--on-solid);
}
.seg button em {
  font-style: normal;
  font-size: .6875rem;
  min-width: 1.25rem;
  height: 1.125rem;
  padding: 0 .3125rem;
  border-radius: 62.4375rem;
  display: grid;
  place-items: center;
  background: var(--soft-2);
  color: var(--muted);
}
.seg button.on em {
  background: color-mix(in srgb, var(--on-solid) 20%, transparent);
  color: var(--on-solid);
}
.seg-thumb {
  position: absolute;
  top: .25rem;
  left: 0;
  height: calc(100% - .5rem);
  border-radius: 62.4375rem;
  background: var(--solid);
  box-shadow: 0 .375rem 1rem -.5rem rgb(0 0 0 / 0.45);
  transition:
    transform 0.55s var(--ease),
    width 0.55s var(--ease);
}

/* -------------------------------------------------------------- switch -- */
.toggle {
  position: relative;
  width: 3.125rem;
  height: 1.875rem;
  border-radius: 62.4375rem;
  flex-shrink: 0;
  background: var(--soft-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background-color 0.3s;
}
.toggle i {
  position: absolute;
  top: .1875rem;
  left: .1875rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 .1875rem .5rem rgb(0 0 0 / 0.22);
  transition:
    transform 0.45s var(--spring),
    width 0.2s;
}
.toggle:active i {
  width: 1.875rem;
}
.toggle.on {
  background: var(--accent);
  box-shadow: none;
}
.toggle.on i {
  transform: translateX(1.25rem);
}
.toggle.on:active i {
  transform: translateX(.875rem);
}

/* -------------------------------------------------------------- inputs -- */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-width: 0;
}
.field > span:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .625rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink-2);
}
.field > span:first-child small {
  font-weight: 400;
  font-size: .75rem;
  color: var(--muted);
  text-align: right;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.input {
  width: 100%;
  height: var(--h-btn);
  padding: 0 1rem;
  border: 0;
  border-radius: .875rem;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: .9375rem;
  transition:
    box-shadow 0.25s,
    background-color 0.25s;
}
.input::placeholder {
  color: var(--faint);
}
.input:focus {
  background: var(--soft-2);
  box-shadow: inset 0 0 0 1.5px var(--ink-2), 0 0 0 .25rem color-mix(in srgb, var(--accent) 18%, transparent);
}
/* $ before / м² after the value */
.affix {
  position: relative;
  display: block;
}
.affix b,
.affix em {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  pointer-events: none;
}
.affix b {
  left: 1rem;
}
.affix b + .input {
  padding-left: 2rem;
}
.affix em {
  right: 1rem;
}
.affix .input:has(+ em) {
  padding-right: 2.75rem;
}
/* an icon in front of the value (login fields) */
.affix.lead > .ic:first-child {
  position: absolute;
  z-index: 1;
  left: 1rem;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
}
.affix.lead .input {
  padding-left: 2.875rem;
}
/* show / hide password */
.affix .pw-eye {
  position: absolute;
  top: 50%;
  right: .3125rem;
  translate: 0 -50%;
  color: var(--muted);
}
.affix .input:has(+ .pw-eye) {
  padding-right: 3.25rem;
}

/* text button: «Забули пароль?» */
.link {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  border-radius: .375rem;
  font-size: .8125rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
  text-underline-offset: .1875rem;
}
.link:hover {
  text-decoration: underline;
}

.search-field {
  display: flex;
  align-items: center;
  gap: .625rem;
  height: var(--h-btn);
  padding: 0 1rem;
  border-radius: 62.4375rem;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  transition:
    box-shadow 0.25s,
    background-color 0.25s;
}
.search-field:focus-within {
  background: var(--soft-2);
  box-shadow: inset 0 0 0 1.5px var(--ink-2), 0 0 0 .25rem color-mix(in srgb, var(--accent) 18%, transparent);
}
.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: .9062rem;
}
.search-field input::placeholder {
  color: var(--faint);
}

/* -------------------------------------------------------------- badges -- */
.delta {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  height: 1.5rem;
  padding: 0 .5625rem 0 .4375rem;
  border-radius: 62.4375rem;
  font-size: .75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.delta.up {
  color: var(--green);
  background: var(--green-bg);
}
.delta.down {
  color: var(--red);
  background: var(--red-bg);
}
.delta.flat {
  color: var(--muted);
  background: var(--soft);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 1.75rem;
  padding: 0 .75rem;
  border-radius: 62.4375rem;
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: .7812rem;
  font-weight: 600;
  color: var(--ink-2);
}

/* status: • Опубліковано */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .4375rem;
  height: 1.875rem;
  padding: 0 .8125rem 0 .6875rem;
  border-radius: 62.4375rem;
  font-size: .7812rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--soft);
  color: var(--ink-2);
}
.status-pill i,
.olx-dot i {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: currentColor;
}
.s-published {
  color: var(--green);
  background: var(--green-bg);
}
.s-published i {
  animation: pulse 2.4s infinite;
  --accent: var(--green);
}
.s-draft {
  color: var(--muted);
}
.s-sold {
  color: var(--blue);
  background: var(--blue-bg);
}
.s-removed {
  color: var(--red);
  background: var(--red-bg);
}

/* stage colours for the deal pipeline (always shown next to a label) */
.stage-dot {
  width: .625rem;
  height: .625rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 .1875rem color-mix(in srgb, currentColor 18%, transparent);
  background: currentColor;
}
.s-new {
  color: #8a94a6;
}
.s-showing {
  color: #6e8bff;
}
.s-negotiation {
  color: #e7a325;
}
.s-deposit {
  color: #a77bf3;
}
.s-deal {
  color: #22b573;
}

.avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 86%, #000));
  color: var(--on-accent);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.35);
}
.avatar.sm {
  width: 2.125rem;
  height: 2.125rem;
  font-size: .75rem;
}
.avatar.xl {
  width: 5.25rem;
  height: 5.25rem;
  font-size: 1.625rem;
}

/* --------------------------------------------------------------- empty -- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .375rem;
  padding: 3rem 1.25rem;
  color: var(--muted);
}
.empty.small {
  padding: 1.75rem 1rem;
}
.empty > span {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  margin-bottom: .375rem;
  color: var(--ink-2);
}
.empty strong {
  color: var(--ink);
  font-weight: 600;
  font-size: .9688rem;
}
.empty .btn {
  margin-top: .875rem;
}
