/* =========================================================================
   Psy App — дневник поведенческой активации
   Дизайн-язык: приглушённая палитра низкой насыщенности, крупные тач-таргеты,
   контраст по WCAG 2.2 (4.5:1 текст / 3:1 элементы). Тёмная тема — своя
   палитра, не инверсия. Никакого стекла поверх текста.

   Три палитры на выбор (переключатель на экране «Итоги»): шалфей, дым,
   графит. Ставятся атрибутом data-palette на <html>; без атрибута — шалфей.
   Порядок блоков важен: у `:root` и `[data-palette="…"]` одинаковая
   специфичность, побеждает тот, что ниже.
   ========================================================================= */

/* --- Общие токены, не зависящие от палитры ----------------------------- */
:root {
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --tap: 44px;
  --gutter: 18px;
  --tabbar-h: 62px;

  --dur: 180ms;
  --ease: cubic-bezier(.32, .72, .3, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
          "Helvetica Neue", system-ui, sans-serif;

  --shadow-card: 0 1px 2px rgba(20, 22, 20, .05), 0 4px 14px rgba(20, 22, 20, .05);
  --shadow-lift: 0 6px 28px rgba(20, 22, 20, .16);
  --danger: #A8402F;
}

@media (prefers-color-scheme: dark) {
  :root {
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-lift: 0 6px 28px rgba(0, 0, 0, .5);
    --danger: #EE9382;
  }
}

/* --- Палитра «Шалфей» (по умолчанию) ----------------------------------- */
:root,
[data-palette="sage"] {
  --bg:            #F4F5F1;
  --surface:       #FDFDFB;
  --surface-2:     #E8EBE4;
  --surface-sunk:  #E2E6DC;
  --text:          #232725;
  --text-muted:    #5E6660;
  --text-faint:    #66706A;
  --accent:        #3F7059;
  --accent-ink:    #FFFFFF;
  --accent-soft:   #DEEAE2;
  --border:        #DDE2D9;
  --border-strong: #C5CDC1;
  --scale-lo:      #A9C2B4;
  --scale-hi:      #3F7059;
}

@media (prefers-color-scheme: dark) {
  :root,
  [data-palette="sage"] {
    --bg:            #141816;
    --surface:       #1D2320;
    --surface-2:     #28302C;
    --surface-sunk:  #0E1211;
    --text:          #E9EFEA;
    --text-muted:    #9DA8A1;
    --text-faint:    #7C8880;
    --accent:        #7FB79A;
    --accent-ink:    #0F1613;
    --accent-soft:   #24332C;
    --border:        #2E3833;
    --border-strong: #414D46;
    --scale-lo:      #4E6559;
    --scale-hi:      #7FB79A;
  }
}

/* --- Палитра «Дым» ------------------------------------------------------ */
[data-palette="slate"] {
  --bg:            #F2F4F6;
  --surface:       #FCFDFE;
  --surface-2:     #E5EAEF;
  --surface-sunk:  #DFE5EB;
  --text:          #212529;
  --text-muted:    #59616B;
  --text-faint:    #646D78;
  --accent:        #3B6188;
  --accent-ink:    #FFFFFF;
  --accent-soft:   #DFE9F2;
  --border:        #DBE1E8;
  --border-strong: #C2CBD4;
  --scale-lo:      #AEC2D3;
  --scale-hi:      #3B6188;
}

@media (prefers-color-scheme: dark) {
  [data-palette="slate"] {
    --bg:            #121517;
    --surface:       #1B1F22;
    --surface-2:     #262B30;
    --surface-sunk:  #0C0E10;
    --text:          #E8ECEF;
    --text-muted:    #9AA4AD;
    --text-faint:    #7A848D;
    --accent:        #7FA8CE;
    --accent-ink:    #0E1418;
    --accent-soft:   #22303C;
    --border:        #2C3338;
    --border-strong: #3E464D;
    --scale-lo:      #4B5F73;
    --scale-hi:      #7FA8CE;
  }
}

/* --- Палитра «Графит» (почти без цвета) --------------------------------- */
[data-palette="graphite"] {
  --bg:            #F4F4F3;
  --surface:       #FCFCFB;
  --surface-2:     #E9E9E7;
  --surface-sunk:  #E3E3E1;
  --text:          #1F2020;
  --text-muted:    #5C5D5C;
  --text-faint:    #666867;
  --accent:        #3A3C3B;
  --accent-ink:    #FFFFFF;
  --accent-soft:   #E4E5E3;
  --border:        #DCDCDA;
  --border-strong: #C4C4C2;
  --scale-lo:      #C3C3C1;
  --scale-hi:      #3A3C3B;
}

@media (prefers-color-scheme: dark) {
  [data-palette="graphite"] {
    --bg:            #131313;
    --surface:       #1C1C1C;
    --surface-2:     #272727;
    --surface-sunk:  #0D0D0D;
    --text:          #ECECEA;
    --text-muted:    #A0A09E;
    --text-faint:    #7E7E7C;
    --accent:        #D8D8D4;
    --accent-ink:    #1A1A19;
    --accent-soft:   #2A2A29;
    --border:        #2E2E2D;
    --border-strong: #414140;
    --scale-lo:      #555554;
    --scale-hi:      #D8D8D4;
  }
}
/* --- База -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 27px; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p  { margin: 0; }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- Каркас ------------------------------------------------------------ */
.app { min-height: 100dvh; }

.view {
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter)
           calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 96px);
  max-width: 620px;
  margin: 0 auto;
  outline: none;
}

/* --- Нижняя навигация -------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-top: 1px solid var(--border);
  z-index: 40;
}
@supports not (backdrop-filter: blur(1px)) {
  .tabbar { background: var(--bg); }
}

.tab {
  flex: 1;
  min-height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 550;
  transition: color var(--dur) var(--ease);
}
.tab svg {
  width: 24px; height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab[aria-current="page"] { color: var(--accent); }

/* --- Шапка экрана ------------------------------------------------------ */
.screen-head { margin-bottom: 22px; }
.screen-head .eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.screen-head .sub {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 15.5px;
}

/* --- Секции ------------------------------------------------------------ */
.section { margin-bottom: 28px; }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-title h2 { font-size: 16px; font-weight: 650; color: var(--text-muted); }
.section-title .aside { font-size: 14px; color: var(--text-faint); }

/* --- Карточки ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.stack { display: flex; flex-direction: column; gap: 10px; }

/* Запись дневника */
.entry {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.entry:active { transform: scale(.985); background: var(--surface-2); }
.entry .time {
  flex: 0 0 auto;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  padding-top: 2px;
  min-width: 42px;
}
.entry .body { flex: 1 1 auto; min-width: 0; }
.entry .name {
  font-weight: 550;
  overflow-wrap: anywhere;
}
.entry .note {
  margin-top: 3px;
  font-size: 14.5px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.entry .marks {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding-top: 1px;
}

/* Две цифры записи */
.mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 30px;
}
.mark b {
  font-size: 16px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.mark span {
  font-size: 9.5px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* --- Кнопки ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16.5px;
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost { color: var(--accent); }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .38; pointer-events: none; }

/* Плавающая кнопка добавления */
.fab {
  position: fixed;
  right: max(var(--gutter), calc(50vw - 310px + var(--gutter)));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  display: flex;
  align-items: center;
  gap: 9px;
  height: 56px;
  padding: 0 24px 0 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
  font-weight: 650;
  box-shadow: var(--shadow-lift);
  z-index: 30;
  transition: transform var(--dur) var(--ease);
}
.fab:active { transform: scale(.95); }
.fab svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor;
  stroke-width: 2.4; stroke-linecap: round;
}

/* --- Пустые состояния (без упрёка) ------------------------------------- */
.empty {
  padding: 30px 22px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}
.empty p { color: var(--text-muted); font-size: 15.5px; }
.empty .btn { margin-top: 16px; }

/* --- Слоты плана ------------------------------------------------------- */
.day-card { padding: 6px 4px; }
.day-card.is-today { border-color: var(--accent); }
.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px 6px;
}
.day-head .dow { font-weight: 650; font-size: 16px; }
.day-head .date { font-size: 14px; color: var(--text-faint); }
.day-head .today-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent);
}

.slot {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 9px 14px;
  text-align: left;
  border-top: 1px solid var(--border);
}
.slot:first-of-type { border-top: 0; }
.slot .when {
  flex: 0 0 52px;
  font-size: 13px;
  color: var(--text-faint);
}
.slot .what { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.slot.is-empty .what { color: var(--text-faint); }
.slot.is-done .what { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.slot .check {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
}
.slot.is-done .check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.slot .check svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.slot .marks { flex: 0 0 auto; display: flex; gap: 6px; }

/* --- Шкала 0–10 -------------------------------------------------------- */
.scale { margin-bottom: 26px; }
.scale-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.scale-head .label { font-weight: 600; font-size: 16px; }
.scale-head .value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -.02em;
}
.scale-head .value.is-unset { color: var(--text-faint); font-size: 22px; }

.scale-track {
  position: relative;
  display: flex;
  gap: 4px;
  height: 52px;
  padding: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.scale-seg {
  flex: 1 1 0;
  border-radius: 7px;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
  pointer-events: none;
}
.scale-seg.is-on {
  background: var(--seg-color);
  border-color: transparent;
}
.scale-seg.is-cursor { transform: scaleY(1.08); }

.scale-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 13px;
  color: var(--text-faint);
}

/* --- Поля -------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}
.input, .textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 15px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
}
.textarea { resize: none; line-height: 1.4; }
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }

.row-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 11px 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.row-button .k { color: var(--text-muted); font-size: 15px; }
.row-button .v { font-weight: 550; }

/* --- Поиск и каталог --------------------------------------------------- */
/* Липкий, чтобы поле с набранным текстом не уезжало вверх при скролле
   результатов — на телефоне это главная точка «не вижу, что печатаю». */
.search-wrap {
  position: sticky;
  top: -16px;
  z-index: 3;
  margin: -16px -4px 12px;
  padding: 16px 4px 10px;
  background: var(--bg);
}
.search-wrap { position: -webkit-sticky; position: sticky; }
.search-wrap .input { padding-left: 44px; }
/* Иконка позиционируется от верха, а не по 50%: у липкой обёртки есть
   собственные отступы, и центр её бокса не совпадает с центром поля. */
.search-wrap svg {
  position: absolute;
  left: 19px;
  top: 16px;
  height: 44px;
  width: 19px;
  fill: none; stroke: var(--text-faint);
  stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 38px;
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  transition: transform var(--dur) var(--ease);
}
.chip:active { transform: scale(.96); }
.chip-accent { background: var(--accent-soft); border-color: transparent; color: var(--text); }

.pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  text-align: left;
  border-radius: var(--r-md);
  transition: background var(--dur) var(--ease);
  overflow-wrap: anywhere;
}
.pick-item:active { background: var(--surface-2); }
.pick-item .lead {
  flex: 0 0 auto;
  width: 24px; height: 24px;
  color: var(--accent);
}
.pick-item .lead svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pick-item .kill {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--text-faint);
  border-radius: 50%;
}
.pick-item .kill svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

details.cat { border-bottom: 1px solid var(--border); }
details.cat > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 12px 4px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary .count { margin-left: auto; font-size: 14px; color: var(--text-faint); font-weight: 400; }
details.cat > summary .caret {
  width: 18px; height: 18px;
  fill: none; stroke: var(--text-faint);
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--dur) var(--ease);
}
details.cat[open] > summary .caret { transform: rotate(90deg); }

/* --- Нижний шит -------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 14, .42);
  z-index: 50;
  animation: fade var(--dur) var(--ease);
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lift);
  z-index: 51;
  animation: rise 260ms var(--ease);
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px var(--gutter) 10px;
  border-bottom: 1px solid var(--border);
}
.sheet-head h2 { flex: 1 1 auto; font-size: 18px; }
.sheet-head .close {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
}
.sheet-head .close svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.sheet-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px var(--gutter);
}
.sheet-foot {
  padding: 12px var(--gutter) calc(env(safe-area-inset-bottom) + 14px);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { transform: translateY(100%) } to { transform: translateY(0) } }

/* --- Тост -------------------------------------------------------------- */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 84px);
  transform: translateX(-50%);
  z-index: 60;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 15.5px;
  font-weight: 550;
  box-shadow: var(--shadow-lift);
  animation: toast-in 240ms var(--ease);
  text-align: center;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.96) }
  to   { opacity: 1; transform: none }
}

/* --- Итоги ------------------------------------------------------------- */
.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-sunk);
  border-radius: 999px;
  margin-bottom: 22px;
}
.segmented button {
  flex: 1 1 0;
  min-height: 38px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 550;
  color: var(--text-muted);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.bignums {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.bignum {
  padding: 16px 12px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.bignum b {
  display: block;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.bignum span {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.25;
}

.insight {
  padding: 18px 20px;
  background: var(--accent-soft);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
}
.insight p + p { margin-top: 10px; }
.insight strong { font-weight: 650; }

.chart {
  padding: 16px 14px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .dot { fill: var(--accent); }
.chart .link { stroke: var(--accent); stroke-width: 2; fill: none; opacity: .35; }
.chart .lbl { fill: var(--text-faint); font-size: 10px; }

/* --- Прочее ------------------------------------------------------------ */
.note-line {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.4;
}

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

/* --- Переключатель палитры --------------------------------------------- */
.palettes { display: flex; gap: 10px; }
.palette-btn {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-muted);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.palette-btn:active { transform: scale(.97); }
.palette-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.palette-swatch {
  display: flex;
  width: 46px; height: 26px;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .09);
}
.palette-swatch i { flex: 1 1 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
