/* RESET / BASE */

/* === КРИТИЧНЕ: ПРИБРАТИ БІЛІ СМУГИ === */
* {
  margin: 0;
  padding: 0;
}

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

/* === RESET ДЛЯ КНОПОК === */
button {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}


html {
  font-size: 1rem;
  background: var(--color-bg) !important;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  height: 100dvh;
  max-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  background: var(--color-bg) !important;
  color: var(--color-text);
  width: 100%;
}

/* THEME TOKENS */

:root {
  --color-bg: #F3F4F7;
  --color-surface: #FFFFFF;
  --color-surface-subtle: #F9FAFB;
  --color-border: #E5E7EB;
  --color-text: #111827;
  --color-text-secondary: #6B7280;
  --color-icon: #6B7280;
  --color-placeholder: #9CA3AF;
  --color-primary: #7C6AA2;
  --color-primary-soft: #E0EDFF;
  --color-error-soft: #F3F4F6;

  --radius-card: 18px;
  --radius-pill: 999px;
  --shadow-card: 0 10px 24px rgba(15, 23, 42, 0.108);
}

/* DARK THEME */
html.dark-theme {
  --color-bg: #000000;
  --color-surface: #1C1C1E;
  --color-surface-subtle: #2C2C2E;
  --color-border: #38383A;
  --color-text: #FFFFFF;
  --color-text-secondary: #8E8E93;
  --color-icon: #8E8E93;
  --color-placeholder: #636366;
  --color-primary: #7C6AA2;
  --color-primary-soft: #1E3A5F;
  --color-error-soft: #2C2C2E;
  --shadow-card: 0 10px 24px rgba(0, 0, 0, 0.5);
  
  background: #000000 !important;
}

html.dark-theme body {
  background: var(--color-bg) !important;
  color: var(--color-text);
}

#app-root {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--color-bg) !important;
}

/* PAGE LAYOUT */

.page {
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* HEADER */

.page-header {
  flex-shrink: 0;
  padding: max(8px, calc(env(safe-area-inset-top, 0px) - 8px)) 16px 8px;
  background: var(--color-bg);
}

.page-title-main {
  font-size: 1.75rem;
  font-weight: 700;
}

.page-title-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  padding: 0 16px;
}

/* КОНТЕНТ */

.page-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px calc(56px + env(safe-area-inset-bottom, 0px) / 2) 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--color-bg);
}

/* HOME PAGE LAYOUT - фіксований календар, події скролляться */
#homePage {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

#homePage .page-header {
  flex-shrink: 0;
}

#homePage .page-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 10px;
  padding-bottom: 0;
}

#homeUpcomingCard {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#homeUpcomingCard::-webkit-scrollbar {
  display: none;
}

#homeCalendarCard {
  flex-shrink: 0;
  padding: 12px 8px 0;
}

/* Links page — main fills remaining space, no scroll (graph handles it) */
#linksPage > main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* People page — search pill sticks to top of scrollable page-content */
#peoplePage .search-pill-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-bg);
  padding-bottom: 2px;
}

/* SEARCH FIELD - універсальне поле пошуку */

.search-wrapper {
  display: none;
}

.search-wrapper.visible,
.search-wrapper.always-visible {
  display: block;
}

/* === ANIMATED SEARCH PILL (people page) === */
.search-pill-wrap {
  display: flex;
  align-items: center;
}

.search-pill {
  display: flex;
  align-items: center;
  height: 46px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  overflow: hidden;
  width: 160px;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease,
              background 0.3s ease;
  cursor: pointer;
}

.search-pill.expanded {
  width: 100%;
  cursor: default;
  background: var(--color-surface);
  border-color: var(--color-border);
}

.search-pill-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin: 4px 0;
}

.search-pill-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
  background-color: white;
  -webkit-mask-image: url(assets/icons/ui/search.svg);
  mask-image: url(assets/icons/ui/search.svg);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.search-pill-label {
  padding: 0 12px 0 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s ease, max-width 0.3s ease, padding 0.3s ease;
}

.search-pill.expanded .search-pill-label {
  opacity: 0;
  max-width: 0;
  padding: 0;
}

.search-pill-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 1rem;
  color: var(--color-text);
  padding: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease 0.15s;
}

.search-pill.expanded .search-pill-input {
  opacity: 1;
  pointer-events: auto;
  padding: 0 8px;
}

.search-pill-clear {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.search-pill.has-text .search-pill-clear {
  opacity: 1;
  pointer-events: auto;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-border);
  border-radius: 999px;
  padding: 8px 12px;
}

.search-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-border);
  border-radius: 999px;
  padding: 8px 12px;
}

.search-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--color-text);
}

.search-input::placeholder {
  opacity: 0.7;
}

.search-input:focus {
  outline: none;
}


/* КАРТОЧКИ (як у contact-card) */

.card {
  border-radius: var(--radius-card);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-inner-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}


.card-header {
  padding: 16px 24px 12px;
}

.card-section {
  padding: 16px 24px;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

/* PROFILE BLOCK (аватар + ім'я + тип зв'язку) */


.profile-edit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.profile-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  margin-bottom: 8px;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-avatar img,
.contact-avatar img,
.relation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  line-height: 1.2;
}

.profile-relation {
  font-size: 1rem;
  text-align: center;
  line-height: 1.3;
}

/* CARD LABEL */

.card-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* ПОЛЯ ВВОДУ БЕЗ ЛЕЙБЛА (PLACEHOLDER CAPS INSIDE) */

.field {
  border-radius: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-placeholder {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-placeholder);
}

.field-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--color-text);
}

.field-input::placeholder {
  color: var(--color-placeholder);
}

/* ПОМИЛКИ / ПОПЕРЕДЖЕННЯ (сірим) */

.field-error {
  margin-top: 4px;
  font-size: 1rem;
}

/* КНОПКИ */

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* Готово — синя обʼємна кнопка */
.btn-primary {
  border: none;
  outline: none;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: 0 6px 14px rgba(10, 132, 255, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Скасувати — текстова кнопка */
.btn-text {
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 500;
  padding: 8px 4px;
  cursor: pointer;
}

/* "Змінити" — синій текст + синя іконка попереду */

.action-link {
  border: none;
  outline: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-primary);
  cursor: pointer;
}

.action-link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.chevron-left {
  font-size: 24px;
  font-weight: 300;
  margin-right: 4px;
}

/* ТАБИ */

.tabs-strip {
  display: flex;
  background: var(--color-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  margin: 0 4px;
  container-type: inline-size;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 8px 16px 0;
}


/* МОДАЛЬНІ ВІКНА */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
  z-index: 1100;
}

.modal-backdrop.is-visible {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  margin: 0 16px;
  border-radius: 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  /* box-shadow: var(--shadow-card); */
  padding: 14px;
}

.modal-header {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* КАЛЕНДАР */

.calendar-nav-btn {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--color-text);
}

html.dark-theme .calendar-nav-btn {
  color: #FFFFFF;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  text-align: center;
  padding: 0 1rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  row-gap: 4px;
  font-size: 0.875rem;
  padding: 0 4px;
  margin-bottom: 1rem;
}

.calendar-day {
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.calendar-day.empty {
  cursor: default;
}

.calendar-day.today {
  background: var(--color-primary-soft);
  font-weight: 600;
  border: 2px solid var(--color-primary);
}

.calendar-day.selected {
  background: var(--color-primary);
  color: #FFFFFF;
  font-weight: 600;
}

.calendar-day.has-events {
  background: var(--color-primary);
  color: #FFFFFF;
  font-weight: 600;
}

.calendar-day.today.has-events {
  background: var(--color-primary);
  color: #FFFFFF;
  font-weight: 600;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 2px var(--color-primary);
}

.calendar-day.has-events .calendar-day-dot {
  display: none;
}

.calendar-day-count {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 0.625rem;
  font-weight: 600;
  color: #FFFFFF;
  line-height: 1;
}

/* BOTTOM NAV (футер без окремого острова) */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0 !important;
  background: rgba(243, 244, 247, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
  display: flex;
  flex-direction: column;
}

.bottom-nav::after {
  content: '';
  display: block;
  height: calc(env(safe-area-inset-bottom, 0px) / 2);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

/* Темна тема */
html.dark-theme .bottom-nav {
  background: rgba(0, 0, 0, 0.95);
}

.nav-item {
  text-decoration: none;
  color: var(--color-icon);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 60px;
}

/* Hide text labels in nav */
.nav-item > span:not(.nav-icon) {
  display: none;
}

.icon-mask,
.nav-icon {
  display: block;
  flex-shrink: 0;
  background-color: var(--color-icon);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.nav-icon {
  width: 33px;
  height: 33px;
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item.active .nav-icon {
  background-color: var(--color-primary);
}

/* ============================================================
   HOME – UPCOMING EVENTS
   UA: Домашня сторінка – блок майбутніх подій
   EN: Home page – upcoming events block
   ============================================================ */

.upcoming-month {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upcoming-month-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 0 0;
}

/* Окрема картка події / Single event card */
.event-card {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.event-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Ліва частина / Left side */
.event-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* Імʼя контакту / Contact name (1-й рядок) */
.event-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

/* 2-й рядок: тип звʼязку або "ім'я • тип звʼязку" */
.event-meta {
  font-size: 1rem;
}

/* 3-й рядок: тип події (День народження тощо) */
.event-note {
  font-size: 1rem;
  color: var(--color-primary);
}

/* Лишилось X днів / Days left label – знизу зліва під текстовим блоком */
.event-countdown {
  font-size: 11px;
  margin-top: 4px;
}

/* Права частина (дата) / Right side (date) */
.event-right {
  text-align: right;
  margin-left: auto;  /* відштовхуємо правий блок до краю картки */
  flex-shrink: 0;
}

/* Число і короткий місяць / Day + short month (КАПС) */

/* Аватар з ініціалами / Initials avatar */
.event-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  flex-shrink: 0;
  color: #ffffff;
  overflow: hidden;
}

/* Avatar palette — shades derived from accent color via JS (applyAccentColor) */
.avatar-color-0 { background: var(--avatar-color-0, #7C6AA2); }
.avatar-color-1 { background: var(--avatar-color-1, #9B8DBB); }
.avatar-color-2 { background: var(--avatar-color-2, #B3A8CC); }
.avatar-color-3 { background: var(--avatar-color-3, #5C4E7A); }
.avatar-color-4 { background: var(--avatar-color-4, #483C61); }

/* ============================================================
   CALENDAR NAV ARROWS (HOME)
   UA: Шеврони календаря без сірих кіл
   EN: Calendar arrows without grey circles
   ============================================================ */

.calendar-nav-btn {
  border: none;
  background: transparent;   /* прибираємо кола / remove circles */
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  color: #000000;
}

/* ============================================================
   PEOPLE PAGE
   ============================================================ */

/* === PEOPLE CONTACT CARDS === */
.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
  position: relative;
  transition: opacity 0.15s ease;
}

.contact-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50px;
  right: 0;
  height: 1px;
  background: var(--color-border);
}

.contact-card:last-child::after {
  display: none;
}

.contact-card:hover {
  opacity: 0.8;
}

.contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  overflow: hidden;
  font-weight: 600;
  font-size: 1.125rem;
  flex-shrink: 0;
}

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

.contact-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-relation {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-category-icon {
  width: 24px;
  height: 24px;
  opacity: 0.6;
}

.people-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}


/* ============================================================
   NEW CONTACT PAGE
   ============================================================ */

.new-contact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
}

.header-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1.125rem;
  cursor: pointer;
  padding: 4px;
}

.header-save-btn {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}

.page-title-center {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  flex: 1;
}

.avatar-section {
  padding: 0;
}

.avatar-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 32px;
  font-weight: 600;
}

.avatar-add-photo {
  position: absolute;
  bottom: 0;
  right: calc(50% - 50px);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-background);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.avatar-add-photo img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.section-title-small {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


/* ============================================================
   PEOPLE PAGE
   ============================================================ */

.people-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 10px;
}

.people-header-actions {
  display: flex;
  gap: 4px;
}

.icon-button {
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button:active {
  background: rgba(0, 0, 0, 0.06);
}

.icon-button img {
  width: 22px;
  height: 22px;
}

.dark-theme .icon-button img {
  filter: brightness(0) invert(1);
}

.icon-button {
  border: none;
  background: transparent;
  padding: 6px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button:active {
  background: rgba(0, 0, 0, 0.06);
}

.icon-button img {
  width: 22px;
  height: 22px;
}




.contact-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-name {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-relation {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-category-icon {
  width: 22px;
  height: 22px;
}

/* ============================================================
   NEW CONTACT PAGE
   ============================================================ */

.new-contact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
}

.header-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
}

/* Avatar */
.avatar-block {
  display: flex;
  justify-content: center;
  position: relative;
}

/* Field error message */
.field-error {
  color: #ff3b30;
  margin-top: 4px;
  padding: 0 16px;
}

.form-label {
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--color-surface);
  outline: none;
}

.form-input:focus {
  border-color: var(--color-primary);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  font-size: 1rem;
}

.field-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.6;
}

.dark-theme .field-icon {
  filter: brightness(0) invert(1);
}

/* Add field button */
.add-field-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.add-field-btn img {
  width: 20px;
  height: 20px;
}

/* Add section */
.add-section {
  padding: 0 16px;
  margin-bottom: 12px;
}

.add-section-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.add-section-btn:hover {
  text-decoration: underline;
}

.add-icon {
  width: 22px;
  height: 22px;
}

.section-title-small {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================================
   iOS PICKER (CAROUSEL)
   ============================================================ */

.ios-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ios-picker-backdrop.visible {
  opacity: 1;
}

.ios-picker-container {
  width: 90%;
  max-width: 320px;
  background: var(--color-surface);
  border-radius: 18px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ios-picker-backdrop.visible .ios-picker-container {
  transform: scale(1);
}

.ios-picker-header {
  padding: 16px;
  text-align: center;
}

.ios-picker-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.ios-picker-footer {
  display: flex;
  padding: 0;
  gap: 8px;
}

.ios-picker-footer .modal-btn-text {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  padding: 12px;
  cursor: pointer;
}

.ios-picker-wheel {
  height: 220px;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.ios-picker-indicator {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 44px;
  margin-top: -22px;
  pointer-events: none;
  z-index: 1;
}

.ios-picker-list {
  position: relative;
  will-change: transform;
}

.ios-picker-option {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.ios-picker-option.selected {
  color: var(--color-text);
  font-weight: 600;
  font-size: 20px;
}


/* ============================================================
   CALENDAR MODAL
   ============================================================ */

.calendar-modal {
  max-width: 340px;
  padding: 14px 0;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px 12px;
}

.calendar-month-year {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
}

.calendar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
}

.calendar-footer {
  display: flex;
  padding: 0;
  gap: 8px;
}

.calendar-footer .modal-btn-text {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  padding: 12px;
  cursor: pointer;
}

.calendar-footer .modal-btn-text:last-child {
  font-weight: 600;
}

.calendar-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-month-year-btn {
  border: none;
  background: transparent;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
/* Поля без рамки з placeholder */
.form-input-plain {
  font-family: inherit;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
  color: var(--color-text);
}

/* Роздільник між полями */
.field-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0 24px; /* базовий - без зміщення */
}

/* Для рядків з іконками 20px (icon-base) */
.field-divider--icon {
  margin-left: 56px; /* 24px padding + 20px icon + 12px gap */
}

/* Для рядків з аватарами 24px (avatar-small) */
.field-divider--avatar-small {
  margin-left: 60px; /* 24px + 24px + 12px */
}

/* Для рядків з аватарами 36px (avatar-medium) */
.field-divider--avatar-medium {
  margin-left: 72px; /* 24px + 36px + 12px */
}

/* Для рядків з аватарами 72px (avatar-large) */
.field-divider--avatar-large {
  margin-left: 108px; /* 24px + 72px + 12px */
}

.field-delete-icon {
  width: 20px;
  height: 20px;
  opacity: 0.6;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
}

.form-value-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.form-value-btn.has-value {
  color: var(--color-text);
}

.btn-icon-small {
  width: 20px;
  height: 20px;
}

/* Іконка видалення для додаткових полів */
.remove-field-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.5;
}

.remove-field-btn:hover {
  opacity: 1;
}

.remove-field-btn img {
  width: 20px;
  height: 20px;
}

/* Іконка фото */
.avatar-add-photo img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
  opacity: 1;
}



/* ============================================================
   CONTACT CARD
   ============================================================ */

/* Top Header */
.top-header {
  flex-shrink: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 6px;
  background: var(--color-bg);
}

.top-header-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 90px;
  flex: 0 0 90px;
}

.top-header-side:last-child {
  justify-content: flex-end;
}

.top-header-center {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: var(--color-text);
}

.top-header-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  padding: 0;
  font-size: 1.125rem;
  color: var(--color-primary);
  cursor: pointer;
  white-space: nowrap;
}

.top-header-button span.chevron {
  font-size: 18px;
  line-height: 1;
}

.top-header-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  padding: 0;
  font-size: 1.125rem;
  color: var(--color-primary);
  cursor: pointer;
}

.top-header-edit img {
  width: 14px;
  height: 14px;
}

/* Header Card */
.header-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  margin: 8px 16px 12px;
  padding: 24px 16px;
  text-align: center;
  /* box-shadow: var(--shadow-card); */
}

.header-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  margin: 0 auto 12px;
  overflow: hidden;
}

.header-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.header-relation {
  font-size: 1rem;
}

/* Tabs */
.tabs-wrap {
  display: flex;
  gap: 8px;
  padding: 0 16px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.tab-pill {
  flex: 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  padding: 8px 6px;
  font-weight: 500;
  font-size: clamp(0.6rem, 5.5cqi, 0.875rem);
  color: var(--color-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.tab-pill.active {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Block Label */
.block-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 400;
  padding: 14px 16px;
}


/* === СИСТЕМА РЯДКІВ (ЛЕГО) === */

/* Базовий контейнер */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  cursor: pointer;
  position: relative;
  transition: opacity 0.12s;
}

.row:active {
  opacity: 0.6;
}

/* === СИСТЕМА РОЗДІЛОВИХ ЛІНІЙ === */

/* Базова лінія - тільки для рядків з класом row--divider */
.row--divider::after {
  content: '';
  position: absolute;
  left: 0;
  right: -24px;
  bottom: -7px; /* половина gap 12px */
  height: 1px;
  background: var(--color-border);
}

/* Прибрати лінію після останнього рядка */
.row--divider:last-child::after {
  display: none;
}

/* Settings confidentiality — 1.5x row spacing */
#settingsConfidentialityPage .card {
  gap: 18px;
}
#settingsConfidentialityPage .card .row--divider::after {
  bottom: -9px;
}

/* Зміщення для іконок 20px */
.row--divider.row--icon::after {
  left: 32px; /* 20px icon + 12px gap */
}

/* Зміщення для icon-xl (36px) — рядки з великими іконками (налаштування) */
.row--divider:has(.icon-xl)::after {
  left: 48px; /* 36px icon + 12px gap */
}

/* Зміщення для рядків з чекбоксом (send contact modal) */
#sendContactModal .row--divider::after {
  left: 28px; /* ~16px checkbox + 12px gap */
  right: 0;
}

/* Зміщення для avatar-small 24px */
.row--divider.row--avatar-small::after {
  left: 36px; /* 24px + 12px */
}

/* Зміщення для avatar-medium 36px */
.row--divider.row--avatar-medium::after {
  left: 48px; /* 36px + 12px */
}

/* Зміщення для avatar-large 72px */
.row--divider.row--avatar-large::after {
  left: 84px; /* 72px + 12px */
}

/* Розділова лінія для рядків з іконкою/аватаром */

/* Іконка/Аватар */
.row-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.row-icon img {
  width: 100%;
  height: 100%;
  opacity: 0.6;
}

/* Основний текстовий блок */
.row-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Текстові стилі */
.row-text-primary {
  font-size: 1rem;
  color: var(--color-text);
}

.row-text-secondary {
  font-size: 0.875rem;
}

/* Дія справа */
.row-action {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}


/* Row menu (···) */
.row-menu-wrap {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
  margin-right: -4px;
}

.row-menu-btn {
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
  padding: 4px 10px;
  color: var(--color-text-secondary);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pill islands — individual floating pills, no shared container */
.row-menu-items {
  position: absolute;
  top: calc(100% + 4px);
  right: -4px;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 1000;
  pointer-events: none;
}

.row-menu-items.open {
  display: flex;
  pointer-events: all;
}

.row-menu-item {
  display: block;
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateX(20px);
}

.row-menu-items.open .row-menu-item {
  animation: row-menu-item-in 0.22s ease forwards;
  animation-delay: calc(var(--i, 0) * 0.05s);
}

@keyframes row-menu-item-in {
  to { opacity: 1; transform: translateX(0); }
}

.row-menu-item--danger {
  color: #ef4444;
}

.row-menu-item:hover {
  background: var(--color-bg);
}

/* Pill add button (like cat-fab-item) */
.add-pill-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  align-self: center;
  transition: background 0.15s;
}

.add-pill-link:active {
  background: var(--color-bg);
}

/* Thumb icons (like/dislike) */
.thumb-icon {
  width: 44px;
  height: 44px;
  cursor: pointer;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  background-color: var(--color-text-secondary);
  transition: background-color 0.2s;
}

.thumb-icon.active {
  background-color: var(--color-primary);
}

.thumb-up {
  mask-image: url(assets/icons/ui/thumbup.svg);
  -webkit-mask-image: url(assets/icons/ui/thumbup.svg);
}

.thumb-down {
  mask-image: url(assets/icons/ui/thumbdown.svg);
  -webkit-mask-image: url(assets/icons/ui/thumbdown.svg);
}

/* Tree Row */



.tree-main img {
  width: 18px;
  height: 18px;
  opacity: 0.6;
}

.delete-contact-btn {
  width: 100%;
  padding: 12px 24px;
  background: transparent;
  border: none;
  color: #EF4444;
  font-size: 1rem;
  cursor: pointer;
  text-align: center;
}






/* === АВАТАРИ === */

/* Базовий стиль для всіх аватарів */
.avatar {
  border-radius: 50% !important;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

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

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

  border-radius: 50% !important;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

/* Розміри */
.avatar-large {
  width: 72px;
  height: 72px;
  font-size: 2rem;
}

.avatar-xlarge {
  width: 120px;
  height: 120px;
  font-size: 3rem;
}

.avatar-medium {
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

.avatar-small {
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
}

/* Add Row */
.add-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  cursor: pointer;
}

/* Аліаси для різних типів add-row */

.add-row img {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.add-link-row img,
.add-like-row img,
.add-event-row img,
.add-gift-row img {
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.add-text {
  font-size: 1rem;
  color: var(--color-primary);
  font-weight: 500;
}

/* Аліаси для різних текстів */
.add-link-text,
.add-like-text,
.add-event-text,
.add-gift-text {
  font-size: 1rem;
  color: var(--color-primary);
  font-weight: 500;
}

.add-big-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  cursor: pointer;
  margin-top: 12px;
  border-top: 1px solid var(--color-border);
}

.add-big-row-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 300;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 24px;
  font-size: 1rem;
  color: var(--color-text-secondary);
}

.relation-chevron {
  font-size: 18px;
}

/* Likes Block */

.likes-block {
  margin-top: 8px;
}






.like-value {
  font-size: 1rem;
  text-align: right;
}

.event-edit-btn {
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.event-edit-btn img {
  width: 18px;
  height: 18px;
  opacity: 0.6;
}

.emoji {
  font-size: 24px;
}

/* Events Block */
.events-block {
  display: flex;
  flex-direction: column;
}





.event-edit {
  width: 20px;
  height: 20px;
  cursor: pointer;
  opacity: 0.5;
}

/* Gifts Block */
.gifts-block {
  display: flex;
  flex-direction: column;
}





.gift-emoji {
  font-size: 24px;
}

/* Add Button */
.add-button {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  border: 1px dashed var(--color-border);
  background: transparent;
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

.add-button img {
  width: 20px;
  height: 20px;
}

/* Empty State */


/* ============================================================
   MODALS
   ============================================================ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-hidden {
  display: none;
}

.modal-card-small {
  max-width: 300px;
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.modal-header.view-header {
  justify-content: space-between;
}

.pref-view-edit {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.pref-view-edit img {
  width: 18px;
  height: 18px;
}

.pref-view-body {
  padding: 16px;
  font-size: 1rem;
  min-height: 60px;
}

.modal-single-action {
  padding: 0 1rem 1rem 1rem;
  text-align: center;
}

.modal-single-action button {
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.modal-single-action button:hover {
  opacity: 0.8;
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 1rem;
}

.modal-body .modal-input-clean {
  margin: 0;
}

.modal-body .modal-textarea-clean {
  margin: 4px 0;
}

.modal-body .modal-error {
  margin: 0;
  padding: 4px 0;
}

/* ЗАСТАРІЛІ КЛАСИ - НЕ ВИКОРИСТОВУВАТИ!
   Використовуйте .modal-input-clean замість .modal-input
   Використовуйте .modal-textarea-clean замість .modal-textarea
*/

.input-field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.input-field:focus {
  border-color: var(--color-primary);
}

.modal-input-hidden {
  display: none;
}

/* ЗАСТАРІЛИЙ .modal-textarea ВИДАЛЕНО - використовуйте .modal-textarea-clean */

.modal-footer {
  padding: 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* === МОДАЛЬНІ КНОПКИ === */

.modal-btn-primary {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  font-family: inherit;
}

.modal-btn-primary:hover {
  opacity: 0.8;
}

.modal-btn-secondary {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-primary);
  cursor: pointer;
  font-family: inherit;
}

.modal-btn-secondary:hover {
  opacity: 0.8;
}

.modal-btn-danger {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #ff3b30;
  cursor: pointer;
  font-family: inherit;
}

.modal-btn-danger:hover {
  opacity: 0.8;
}

/* === ХЕДЕР КНОПКИ === */

.header-back-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-size: 1.125rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.header-back-btn .chevron {
  font-size: 1.25rem;
  line-height: 1;
}

.header-home-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 8px;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.header-home-btn .chevron {
  font-size: 1.25rem;
  line-height: 1;
}

.header-edit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 12px 24px;
  color: var(--color-primary);
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
}

.header-edit-btn img {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

/* === КОНТЕНТ КНОПКИ === */

.add-field-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  cursor: pointer;
}

.add-field-link:hover {
  opacity: 0.8;
}

.add-field-link img {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

.add-field-link span {
  font-size: 1rem;
}

.btn-icon {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  opacity: 0.8;
}

.btn-icon img {
  width: 20px;
  height: 20px;
  opacity: 0.6;
}

/* Thumb Toggle */
.thumb-toggle {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.thumb-btn {
  width: 48px;
  height: 48px;
  border: 2px solid var(--color-border);
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.thumb-btn img {
  width: 24px;
  height: 24px;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.thumb-btn.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.thumb-btn.active img {
  opacity: 1;
}

.toggle-switch-wrapper {
  line-height: 0;
  align-self: center;
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.toggle-input {
  display: none;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  background: var(--color-border);
  border-radius: 15.5px;
  transition: background 0.3s;
  overflow: hidden;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-switch {
  background: var(--color-primary);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

/* Date Input Wrapper (для календаря) */
.calendar-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 0;
}


/* Emoji Selector */
.emoji-selector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
}

.emoji-selector-label {
  font-size: 1rem;
  font-weight: 500;
}

.emoji-selector-btn {
  width: 48px;
  height: 48px;
  border: 2px solid var(--color-border);
  background: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
}

/* Emoji Grid */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 16px;
}

.emoji-item {
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.emoji-item:hover {
  background: var(--color-border);
}

/* === NEW CONNECTION CREATE === */

.search-trigger {
  background: var(--color-surface-subtle);
  border-radius: 999px;
  padding: 0.625rem 1rem 0.625rem 2.75rem;
  cursor: pointer;
  position: relative;
}

.search-trigger::before {
  content: '';
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  background: url('assets/icons/ui/search.svg') center/contain no-repeat;
  opacity: 0.5;
}

.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-surface);
  z-index: 1000;
  max-width: 520px;
  margin: 0 auto;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

.search-modal-header .search-container {
  flex: 1;
}

.search-modal-cancel {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem;
  white-space: nowrap;
}

.search-modal-results {
  padding: 1rem;
  overflow-y: auto;
  max-height: calc(100vh - 3.75rem);
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.search-modal-results::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.quick-create-btn,
.full-create-btn {
  width: 100%;
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  border: none;
  font-size: 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 500;
}

.top-header-save {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: 1.125rem;
  font-weight: 600 !important;
  cursor: pointer;
  padding: 0;
}

.full-create-btn {
  background: var(--color-surface-subtle);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.search-results {
  margin-top: 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Inline search results inside card (new-connection-create) */
.conn-search-results {
  margin-top: 8px;
}

.conn-search-results .search-result-item {
  border-radius: 8px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.search-result-item:hover {
  background: var(--color-surface-subtle);
}

.contact-info-card {
  position: relative;
}

.contact-clear-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.contact-info-layout {
  padding: 12px 0;
}
.contact-info-layout--flush {
  padding: 0;
}

.contact-info-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0;
}

.contact-info-avatar {
  width: 56px;
  height: 56px;
  min-width: 56px;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 600;
  overflow: hidden;
}

.contact-info-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-info-texts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  justify-content: center;
}

.contact-info-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.5;
}

.contact-info-birthday-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  padding-left: 28px;
  padding-right: 28px;
  margin-top: 0.25rem;
  line-height: 1.5;
}

.contact-info-birthday-value {
  color: var(--color-text);
}

.section-label-inside {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 0 0 12px 0;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.info-value {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 500;
}

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px 0 24px;
}

.field-row:last-child {
  padding-bottom: 12px;
}

.label-left {
  font-size: 1rem;
  color: var(--color-text);
}

.value-right {
  font-size: 1rem;
  text-align: right;
  flex: 1;
  cursor: pointer;
}

/* === CATEGORY DROPDOWN (animated, list.txt pattern) === */

.contact-avatar-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
}

/* Hero card: avatar centered + name inputs below */
.new-contact-hero {
  align-items: center;
  padding-top: 24px;
}

.new-contact-hero .row {
  width: 100%;
  align-self: stretch;
}

.category-dropdown {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  overflow: hidden;
  transition: grid-template-rows 0.4s ease, opacity 0.3s ease;
}

/* When dropdown is a direct flex child of .card or .modal-body, cancel the gap while collapsed */
.card > .category-dropdown,
.modal-body > .category-dropdown {
  margin-top: -12px;
}

.category-dropdown.open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.category-dropdown.open .category-dropdown-inner {
  border-color: var(--color-border);
}

.card > .category-dropdown.open,
.modal-body > .category-dropdown.open {
  margin-top: 0;
}

.category-dropdown-inner {
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 12px;
}

.category-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  min-height: 44px;
  color: var(--color-text);
  font-size: 1rem;
  cursor: pointer;
  border-top: 0.5px solid var(--color-border);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.category-option:first-child {
  border-top: none;
}

.category-option:active {
  opacity: 0.6;
}

.check-mark {
  color: var(--color-primary);
  font-size: 1.1rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s;
}

.category-option.active .check-mark {
  opacity: 1;
}

.category-option.active > span:first-child {
  color: var(--color-primary);
  font-weight: 600;
}

.category-dropdown.open .category-option {
  opacity: 1;
  transform: translateY(0);
}

.category-dropdown.open .category-option:nth-child(1) { transition-delay: 0.04s; }
.category-dropdown.open .category-option:nth-child(2) { transition-delay: 0.09s; }
.category-dropdown.open .category-option:nth-child(3) { transition-delay: 0.14s; }
.category-dropdown.open .category-option:nth-child(4) { transition-delay: 0.19s; }
.category-dropdown.open .category-option:nth-child(5) { transition-delay: 0.24s; }

.category-chevron {
  display: inline-block;
  margin-left: 4px;
  color: var(--color-text-secondary);
  transition: transform 0.3s ease;
}

.category-chevron.open {
  transform: rotate(90deg);
}

.chevron-right {
  color: var(--color-text-secondary);
  margin-left: 4px;
}

/* Inline скрол для довгих dropdown (тип зв'язку) */
.relation-inner-wrap {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.relation-scroll {
  flex: 1;
  max-height: 230px;
  overflow-y: auto;
  scrollbar-width: none;
}

.relation-scroll::-webkit-scrollbar {
  display: none;
}

/* Custom scroll indicator — vertical line + dot (like zoom bar) */
.relation-scroll-indicator {
  width: 3px;
  background: #d1d5db;
  border-radius: 2px;
  position: relative;
  margin: 6px 0;
  flex-shrink: 0;
}

.relation-scroll-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #374151;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  transition: top 0.1s linear;
}

html.dark-theme .relation-scroll-indicator {
  background: #38383a;
}

html.dark-theme .relation-scroll-dot {
  background: #d1d5db;
}

/* Прибираємо stagger для динамічно згенерованих опцій у relation-scroll */
.relation-scroll .category-option {
  opacity: 1;
  transform: none;
  transition: opacity 0.12s;
  border-top: 0.5px solid var(--color-border);
  border-bottom: none;
}

.relation-scroll .category-option:first-child {
  border-top: none;
}

/* Modal variants */
.modal-header-centered {
  padding: 16px;
  text-align: center;
}

.modal-body-clean {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==================================================================
   СТАНДАРТНІ МОДАЛКИ - НЕ ЗМІНЮВАТИ!
   ================================================================== */

/* Modal Input Clean - БЕЗ фону, БЕЗ border */
.modal-input-clean {
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  outline: none;
}

.modal-input-clean::placeholder {
  color: var(--color-placeholder);
  font-size: 1rem;
  font-family: inherit;
}

/* Modal Input Inline - для полів в строках */
.modal-input-inline {
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  outline: none;
  text-align: right;
  flex: 1;
}

.modal-input-inline::placeholder {
  font-size: 1rem;
}

/* Modal Footer Centered - вирівнювання по центру */
.modal-footer-centered {
  display: flex;
  padding: 0;
}

.modal-footer-centered .modal-btn-primary,
.modal-footer-centered .modal-btn-secondary,
.modal-footer-centered .modal-btn-danger {
  flex: 1;
  padding: 14px 16px;
}


.modal-btn-secondary,
.modal-btn-primary {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-btn-secondary {
  color: var(--color-primary);
  font-weight: 400;
}

.modal-btn-primary {
  color: var(--color-primary);
  font-weight: 600;
}

.modal-input-group {
  background: var(--color-surface-subtle);
  border-radius: 10px;
  overflow: hidden;
}

.contact-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.contact-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
}


.form-input-plain[type="email"],
input.email-input {
  text-transform: lowercase;
}


/* Edit mode styles */
.editable-field {
  position: relative;
}

.delete-field-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #EF4444;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
}

.add-field {
  cursor: pointer;
  background: var(--color-surface-secondary);
}

.add-field:hover {
  background: var(--color-border);
}

.modal-btn-text {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  color: var(--color-text);
  cursor: pointer;
  border-radius: 8px;
}

.modal-btn-text:hover {
  background: var(--color-surface-secondary);
}

.modal-btn-text-danger {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #EF4444;
  cursor: pointer;
  border-radius: 8px;
}

.modal-btn-text-danger:hover {
  background: #FEE2E2;
}

.contact-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  overflow: hidden;
}

.photo-upload-icon {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  cursor: pointer;
  opacity: 0.8;
}

.photo-upload-icon:hover {
  opacity: 1;
}

.name-inputs-group {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.edit-profile-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0;
}

.edit-avatar-wrapper {
  position: relative;
}

.avatar-upload-wrapper {
  position: relative;
}

.name-input-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0 16px 0 24px;
}

.edit-name-inputs {
  width: 100%;
  max-width: 400px;
}

.edit-name-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 12px 16px;
  font-size: 1rem;
  background: transparent;
  color: var(--color-text);
}

.edit-name-input::placeholder {
  color: var(--color-placeholder);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.action-row:hover {
  background: var(--color-surface-secondary);
}

/* Event Type Option активний стан */
.row.active .text-base {
  font-weight: 600;
}

/* Emoji picker */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 12px 0;
}

.emoji-item {
  font-size: 2rem;
  text-align: center;
  cursor: pointer;
  padding: 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.emoji-item:hover {
  background: var(--color-border);
}

/* Chevron right */
.chevron-right {
  font-size: 1.5rem;
  font-weight: 300;
}

/* UI Icon Small (стандартний розмір для іконок ui) */
.ui-icon-small {
  width: 20px;
  height: 20px;
  opacity: 0.5;
}

/* Modal Title Center - заголовок посередині */
.modal-title-center {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  padding: 16px;
  margin: 0;
}

.modal-text-center {
  text-align: center;
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Modal Button Primary Text - синій текст, напівжирний */
.modal-btn-primary-text {
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  font-family: inherit;
}

.modal-btn-primary-text:hover {
  opacity: 0.8;
}

/* Modal Textarea Clean - БЕЗ фону, БЕЗ border */
.modal-textarea-clean {
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  outline: none;
  min-height: 80px;
  resize: vertical;
}

.modal-textarea-clean::placeholder {
  color: var(--color-placeholder);
  font-size: 1rem;
  font-family: inherit;
}

.modal-textarea-inline {
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-text);
  outline: none;
  flex: 1;
  resize: none;
  overflow: hidden;
  min-height: 24px;
}

/* ==================================================================
   КІНЕЦЬ СТАНДАРТУ МОДАЛОК
   ================================================================== */

/* Item Delete Button - кнопка видалення в кінці рядка */
.item-delete-btn {
  background: transparent;
  border: none;
  padding: 0;
  margin-left: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.item-delete-btn:hover {
  opacity: 0.8;
}

/* Thumbs Container */
.thumbs-container {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

.thumb-icon {
  width: 48px;
  height: 48px;
  cursor: pointer;
}

/* Reaction Grid */
.reaction-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.reaction-item {
  font-size: 2rem;
  text-align: center;
  padding: 8px 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.reaction-item:hover {
  background: var(--color-surface-secondary);
}

.reaction-item.active {
  background: var(--color-primary);
  color: white;
}

.page {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* TABS */
.tabs-wrapper {
  padding: 8px 16px 0;
}

.tabs {
  display: flex;
  background: var(--color-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.tab-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tab-btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

/* CATEGORY FAB FILTER */
.cat-fab-wrapper {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 12px);
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 8px;
}

.cat-fab-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.10);
}

.cat-fab-btn:hover {
  background: var(--color-bg);
}

.cat-fab-btn.has-filter {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.cat-fab-btn:active {
  transform: scale(0.93);
}

/* Список — без спільного фону, кожен елемент на своєму острові */
.cat-fab-dropdown {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.cat-fab-dropdown.open {
  pointer-events: all;
}

.cat-fab-item {
  display: block;
  padding: 10px 22px;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.9375rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  opacity: 0;
  transform: translateY(10px);
}

.cat-fab-dropdown.open .cat-fab-item {
  animation: cat-item-in 0.22s ease forwards;
  animation-delay: calc(var(--i, 0) * 0.05s);
}

@keyframes cat-item-in {
  to { opacity: 1; transform: translateY(0); }
}

.cat-fab-item:hover {
  background: var(--color-bg);
}

.cat-fab-item.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

/* PAN LAYER */
.graph-pan-layer {
  position: absolute;
  inset: 0;
  will-change: transform;
}

.links-graph {
  overflow: visible; /* дозволяє орбітам виходити за межі видимої зони */
}

.graph-empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px;
}

/* ЛІНІЇ ПІД АВАТАРАМИ */
.links-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.orbit-ring {
  fill: none;
  stroke-width: 1;
  opacity: 0.55;
}

.orbit-ring[data-cat="family"]      { stroke: var(--color-primary); }
.orbit-ring[data-cat="friends"]     { stroke: color-mix(in srgb, var(--color-primary) 72%, #fff); }
.orbit-ring[data-cat="work"]        { stroke: color-mix(in srgb, var(--color-primary) 78%, #000); }
.orbit-ring[data-cat="acquaintance"]{ stroke: color-mix(in srgb, var(--color-primary) 52%, #fff); }
.orbit-ring[data-cat="other"]       { stroke: color-mix(in srgb, var(--color-primary) 58%, #000); }

.link-line {
  stroke: #d1d5db;          /* світло-сірий */
  stroke-width: 1.5;        /* тонка */
  stroke-linecap: round;
  stroke-dasharray: 4 4;    /* пунктир */
  fill: none;
  opacity: 0.9;
}

.node {
  position: absolute;
  transform: translate(-50%, 0); /* горизонтально — по центру; вертикально — по верхньому краю аватара */
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.1s;
  z-index: 2;
}


.node-center {
  z-index: 3;
}

.node-avatar {
  position: relative;
  border-radius: 999px;
  /* overflow: hidden;  — не обрізаємо бейдж */
  display: flex;
  align-items: center;
  justify-content: center;
}

.node-avatar--center      { width: 82px;  height: 82px;  }
.node-avatar--family      { width: 66px;  height: 66px;  }
.node-avatar--friends     { width: 49px;  height: 49px;  }
.node-avatar--work        { width: 33px;  height: 33px;  }
.node-avatar--acquaintance{ width: 25px;  height: 25px;  }
.node-avatar--other       { width: 20px;  height: 20px;  }
.node-avatar--filtered    { width: 66px;  height: 66px;  }
.node-avatar--orbit       { width: 44px;  height: 44px;  }

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

.node-avatar-initials {
  font-weight: 600;
  font-size: 18px;
  color: #f9fafb;
}

.node-category-mark {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
}

.node-category-mark img {
  width: 20px;
  height: 20px;
  display: block;
}

.node-label {
  margin-top: 4px;
  text-align: center;
  max-width: 120px;
}

.node-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.node-relation {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.node-center .node-name {
  font-size: 14px;
}

.node-center .node-relation {
  font-size: 12px;
}

/* КОЛЬОРИ ПЛЕЙСХОЛДЕРІВ */

/* ЗУМ */

.zoom-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.zoom-btn {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: none;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  color: #4b5563;
  cursor: pointer;
}

/* ============================================
   LINKS PAGE (Коло зв'язків)
   ============================================ */

/* HEADER */
.links-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--color-bg);
}

.links-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

/* TABS */
.tabs-wrapper {
  padding: 8px 16px 0;
  background: var(--color-bg);
}

.tabs {
  display: flex;
  background: var(--color-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.tab-btn {
  flex: 1;
  border-radius: 999px;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tab-btn.active {
  background: var(--color-surface);
  color: var(--color-text);
  /* box-shadow: var(--shadow-card); */
}

/* CONTACT SEARCH */
.links-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--color-bg);
}

#contactSearchSection {
  padding: 6px 16px 2px;
}


.links-graph-container {
  flex: 1;
  width: 100%;
  height: 0;           /* flex-grow overrides this; makes height definite for absolute children */
  position: relative;
  overflow: hidden;
  min-height: 400px;
  touch-action: none;
  background: var(--color-bg);
}

.links-graph {
  position: absolute;
  inset: 0;
  overflow: visible;
}

/* ZOOM CONTROLS */
.zoom-bar-wrapper {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: 140px;
  padding: 8px 0;
  pointer-events: auto;
}

.zoom-slider {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: #d1d5db; /* буде перезаписано JS-градієнтом */
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  display: block;
}

.zoom-slider::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: transparent; /* JS контролює через inline background */
}
.zoom-slider::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: transparent;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #374151;
  margin-top: -8.5px;
  cursor: grab;
}
.zoom-slider:active::-webkit-slider-thumb {
  background: #1f2937;
  cursor: grabbing;
}
.zoom-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #374151;
  cursor: grab;
}

/* ACCENT COLOR SWATCHES */
.accent-row {
  padding: 10px 0;
}

.accent-swatches {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 2px 0;
}

.accent-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
  box-sizing: border-box;
  padding: 0;
}

.accent-swatch.active {
  border-color: var(--color-text);
  transform: scale(1.15);
}

.accent-swatch-custom {
  background: conic-gradient(
    hsl(0,100%,55%), hsl(45,100%,55%), hsl(90,100%,40%),
    hsl(150,100%,38%), hsl(210,100%,55%), hsl(270,100%,55%),
    hsl(330,100%,55%), hsl(360,100%,55%)
  );
}

/* CONTACT ITEMS (аватари на графі) */
.contact-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.2s;
}

.contact-item:hover {
  transform: scale(1.05);
}

.contact-avatar-graph {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.contact-name-graph {
  font-size: 11px;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-relation-graph {
  font-size: 9px;
  text-align: center;
}

/* === SETTINGS === */

.settings-icon {
  width: 38px;
  height: 38px;
  opacity: 0.7;
  flex-shrink: 0;
}

/* === PROFILE CARD SETTINGS === */
.profile-card-settings {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  cursor: default;
}

.profile-card-settings .row-menu-wrap {
  position: absolute;
  top: 8px;
  right: 8px;
}

.profile-card-settings .profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-card-settings .profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card-settings .profile-info {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.profile-card-settings .profile-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
}

.profile-card-settings .chevron {
  font-size: 1.5rem;
  color: #9ca3af;
}

.hidden {
  display: none !important;
}

/* === УТИЛІТНІ КЛАСИ (замінюють inline styles) === */

/* Header */
.top-header-side--end { justify-content: flex-end; }

/* Flex helpers */
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Row-menu popup positioning (set by JS) */
.row-menu-popup { position: fixed; z-index: 9999; }

/* Row-menu item animation stagger via nth-child */
.row-menu-item:nth-child(1) { --i: 0; }
.row-menu-item:nth-child(2) { --i: 1; }
.row-menu-item:nth-child(3) { --i: 2; }

/* Disabled row / section state (replaces style.opacity + style.pointerEvents) */
/* Trailing group in event/gift rows (date + menu button) */
.row-trailing {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.row-disabled,
.section-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Avatar edit container */
.avatar-edit-container {
  position: relative;
  display: flex;
  justify-content: center;
}

/* Contact tab row */
.contact-tab-row {
  display: flex;
  margin-top: 16px;
}
.contact-tab-cell {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Send-contact field rows */
.send-field-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.send-field-row {
  cursor: pointer;
  gap: 12px;
}
.send-field-checkbox {
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

/* Auth/profile input wrappers */
.input-flex-wrap { flex: 1; }
.input-mt { margin-top: 12px; }

/* Avatar image fill (used inside circular avatar containers) */
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Clear button for form fields (birthday, etc.) */
.field-clear-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}

/* Year/short input: right-aligned, fixed width */
.input-year {
  text-align: right;
  width: 60px;
}

/* Misc */
.w-full-mt { width: 100%; margin-top: 8px; }
.text-right { text-align: right; }
.cursor-pointer { cursor: pointer; }

/* Connections create: new contact button row */
.new-contact-btn-row {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

/* Theme page custom color picker */
.theme-custom-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.theme-custom-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  transition: background 0.15s;
}
.theme-custom-input {
  text-align: center;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  width: 100%;
  max-width: 160px;
}
.theme-swatch-list { margin: 0; }

/* Links page filter/tab bar paddings */
.links-filter-bar { padding: 8px 16px 0; }
.links-tab-pad { padding: 0 4px; }

/* === CONTACT ICON === */
.contact-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}

/* === PROFILE AVATAR === */
.profile-avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}

.profile-avatar-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.5rem;
  font-weight: 600;
  overflow: hidden;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* When inside avatar-edit-container (centered avatar), position at avatar's bottom-right */
.avatar-edit-container .avatar-upload-btn {
  right: calc(50% - 60px);
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.avatar-upload-btn:hover {
  opacity: 0.8;
}

.avatar-upload-btn img {
  display: none;
}

.avatar-upload-btn::after {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  background-color: var(--color-primary);
  -webkit-mask: url('assets/icons/ui/camera.svg') no-repeat center / contain;
  mask: url('assets/icons/ui/camera.svg') no-repeat center / contain;
}

.form-value {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.form-input {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--color-text);
  border: none;
  background: transparent;
  padding: 0;
  display: none;
}

.form-input:focus {
  outline: none;
}

/* === CONTACT ICON === */
.contact-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}

/* === LOGOUT BUTTON === */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  padding: 16px 28px;
  background: transparent;
  border: none;
  color: #ff3b30;
  font-size: 0.9375rem;
  cursor: pointer;
  font-family: inherit;
  margin: 16px auto 0;
}

.logout-btn:hover {
  opacity: 0.8;
}


/* === HEADER TITLE === */
.top-header-center h1 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-text);
}

/* === SETTINGS INFO CARD === */
.settings-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 20px;
  gap: 12px;
}

.settings-info-icon {
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-info-icon img {
  width: 76px;
  height: 76px;
}

.dark-theme .settings-info-icon img {
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

/* About page logo — render SVG as-is, no theme filter */
.about-logo {
  filter: none !important;
  opacity: 1 !important;
  width: 76px;
  height: 76px;
}

.icon-hero {
  display: block;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 55%, #ffffff));
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

/* Per-icon accent color tints + mask-image — no inline styles needed on elements */
/* Settings list order: bell, lock, globe, palette, cloud, info */
/* Perceived lightness:  light, dark,  med-light, v-light, darkened, medium */
.icon-mask.icon-xl.icon-bell,
.icon-hero.icon-bell {
  background: color-mix(in srgb, var(--color-primary) 60%, #ffffff);
  mask-image: url('assets/icons/settings/bell.svg');
  -webkit-mask-image: url('assets/icons/settings/bell.svg');
}

.icon-mask.icon-xl.icon-lock,
.icon-hero.icon-lock {
  background: var(--color-primary);
  mask-image: url('assets/icons/settings/lock.svg');
  -webkit-mask-image: url('assets/icons/settings/lock.svg');
}

.icon-mask.icon-xl.icon-globe,
.icon-hero.icon-globe {
  background: color-mix(in srgb, var(--color-primary) 82%, #ffffff);
  mask-image: url('assets/icons/settings/globe.svg');
  -webkit-mask-image: url('assets/icons/settings/globe.svg');
}

.icon-mask.icon-xl.icon-palette,
.icon-hero.icon-palette {
  background: color-mix(in srgb, var(--color-primary) 42%, #ffffff);
  mask-image: url('assets/icons/settings/palette.svg');
  -webkit-mask-image: url('assets/icons/settings/palette.svg');
}

.icon-mask.icon-xl.icon-cloud,
.icon-hero.icon-cloud {
  background: color-mix(in srgb, var(--color-primary) 90%, #000000);
  mask-image: url('assets/icons/settings/cloud.svg');
  -webkit-mask-image: url('assets/icons/settings/cloud.svg');
}

.icon-mask.icon-xl.icon-info,
.icon-hero.icon-info {
  background: color-mix(in srgb, var(--color-primary) 72%, #ffffff);
  mask-image: url('assets/icons/settings/info.svg');
  -webkit-mask-image: url('assets/icons/settings/info.svg');
}

.icon-mask.icon-xl.icon-delete-data,
.icon-hero.icon-delete-data {
  background: color-mix(in srgb, var(--color-primary) 70%, #ff3b30);
  mask-image: url('assets/icons/settings/delete-data.svg');
  -webkit-mask-image: url('assets/icons/settings/delete-data.svg');
}

.icon-mask.icon-xl.icon-download,
.icon-hero.icon-download {
  background: color-mix(in srgb, var(--color-primary) 55%, #ffffff);
  mask-image: url('assets/icons/settings/download.svg');
  -webkit-mask-image: url('assets/icons/settings/download.svg');
}

/* app logo on about page — render as-is, no mask/gradient override */
.icon-hero--img {
  background: none;
  -webkit-mask-image: none;
  mask-image: none;
  border-radius: 16px;
  object-fit: contain;
}

.settings-info-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.settings-info-description {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.5;
}

/* === CHECKBOX CUSTOM === */
.checkbox-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.checkbox-custom input {
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  transition: all 0.15s;
}

.checkbox-custom input:checked + .checkbox-mark {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-custom input:checked + .checkbox-mark::before {
  content: "✓";
}

.checkbox-custom input:disabled + .checkbox-mark {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === SETTINGS HINT === */
.settings-hint {
  margin-top: 8px;
  padding: 0 4px;
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.4;
}

/* === MODAL LARGE === */
.modal-card-large {
  max-width: 500px;
  width: 90%;
}

/* === MODAL TEXT BLOCK === */
.modal-text-block {
  font-size: 1rem;
  color: #4b5563;
  line-height: 1.6;
  text-align: justify;
  white-space: pre-wrap;
}

/* === DELETE DATA STYLES === */
.delete-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
}

.delete-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.checkbox-label span {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 400;
}



/* === EXPORT DATA STYLES === */
.export-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
}

.export-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.export-option-title {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 400;
}




/* === LANGUAGE SETTINGS STYLES === */
.language-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
}

.language-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.language-option span {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 400;
}

/* Accent color for native inputs */
input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--color-primary);
}

/* === THEME SETTINGS STYLES === */
.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
}

.theme-option input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-option span {
  font-size: 1rem;
  color: var(--color-text);
  font-weight: 400;
}


/* === DARK THEME ICONS === */
html.dark-theme .date-icon,
html.dark-theme .btn-icon-small,
html.dark-theme .add-link-row img,
html.dark-theme .tree-main img,
html.dark-theme .search-icon,
html.dark-theme .icon-base,
html.dark-theme .contact-icon {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

html.dark-theme .search-input {
  color: var(--color-text);
}

html.dark-theme .search-input::placeholder {
  color: var(--color-placeholder);
}

html {
  overflow-x: hidden;
  width: 100%;
  background: var(--color-bg) !important;
}


html.dark-theme {
  background: #000000 !important;
}

html.dark-theme body {
  background: #000000 !important;
}

/* === BACKUP BUTTONS === */
.backup-btn {
  width: 100%;
  max-width: 400px;
  display: block;
  text-align: center;
}

/* === MODAL TEXT === */
.modal-text {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text);
  text-align: center;
  margin: 0;
  padding: 8px 0;
}

/* === ABOUT PAGE === */
.about-main-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px;
}

.about-icon-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}


.about-app-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  margin-bottom: 4px;
}

.about-version {
  font-size: 0.8125rem;
  text-align: center;
  margin-bottom: 16px;
}

.about-description {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text);
  text-align: justify;
  width: 100%;
}

.about-website-btn {
  width: calc(100% - 32px);
  max-width: 400px;
  margin: 16px auto 0;
  display: block;
  text-align: center;
}

.about-contact-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 20px 20px 0;
  width: 100%;
}

.about-contact-label {
  font-size: 0.75rem;
  text-align: center !important;
  width: 100% !important;
  display: block !important;
}

.about-contact-email {
  font-size: 0.9375rem;
  color: var(--color-text);
  font-weight: 500;
  text-align: center !important;
  width: 100% !important;
  display: block !important;
}

/* === WELCOME PAGE === */
.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
  text-align: center;
}

.welcome-logo {
  margin-bottom: 40px;
}

.welcome-logo img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  opacity: 0;
  animation: fadeInScale 0.6s ease-out forwards;
}

.welcome-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  line-height: 1.2;
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.2s forwards;
}

.welcome-description {
  font-size: 0.9375rem;
  margin-bottom: 60px;
  max-width: 320px;
  line-height: 1.5;
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.4s forwards;
}

.welcome-btn {
  background: transparent;
  color: var(--color-primary);
  border: none;
  padding: 16px 0;
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
  font-family: inherit;
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.6s forwards;
}

.welcome-btn:hover {
  opacity: 0.8;
}

.welcome-btn:active {
  opacity: 0.6;
}

/* Анімації */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === AUTH PAGE === */
.auth-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.auth-logo {
  margin-bottom: 32px;
}

.auth-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 32px;
  text-align: center;
}

.auth-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-error {
  color: #ff3b30;
  font-size: 1rem;
  margin-top: -8px;
}

.auth-field-error {
  font-size: 0.8125rem;
  color: #ff3b30;
  padding: 4px 4px 0;
}

.auth-divider {
  width: 100%;
  max-width: 360px;
  position: relative;
  text-align: center;
  margin: 32px 0 24px;
}

.auth-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--color-border);
}

.auth-divider span {
  position: relative;
  background: var(--color-bg);
  padding: 0 16px;
  font-size: 1rem;
}

.auth-social {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

/* Social buttons */
.auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.auth-social-btn:hover {
  opacity: 0.7;
}

.auth-social-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Apple button - чорна іконка, біла у темній темі */
.auth-social-apple .auth-social-icon {
  color: var(--color-text);
}
html.dark-theme .auth-social-apple .auth-social-icon {
  filter: invert(1);
}

.auth-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-footer-text {
  font-size: 1rem;
}

/* Auth link */
.auth-link {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-size: 1rem;
  cursor: pointer;
  padding: 8px 0;
  text-align: right;
  font-family: inherit;
}

.auth-link:hover {
  opacity: 0.8;
}

/* Auth footer link */
.auth-footer-link {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.auth-footer-link:hover {
  opacity: 0.8;
}

/* Suppress native Edge password reveal icon */
input[type=password]::-ms-reveal { display: none; }

/* Password field with show/hide toggle */
.input-with-toggle {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.input-with-toggle input {
  flex: 1;
  padding-right: 36px;
}

.input-toggle-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  background-color: var(--color-text-secondary);
  -webkit-mask: url('assets/icons/ui/eye.svg') no-repeat center / 20px;
  mask: url('assets/icons/ui/eye.svg') no-repeat center / 20px;
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
  transition: opacity 0.15s, background-color 0.15s;
}

.input-toggle-btn.visible {
  background-color: var(--color-primary);
  opacity: 1;
}

/* Auth submit button */
.auth-submit-btn {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 0;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: center;
}

.auth-submit-btn:hover {
  opacity: 0.8;
}

/* Auth button with image */

/* Modal text */
.modal-text {
  font-size: 0.9375rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Profile name under avatar */
.profile-name {
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 12px;
}

/* Card divider */
.card-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0 -24px;
}

/* Contact info header */
.contact-info-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* === UPCOMING EVENTS === */
.upcoming-event-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.upcoming-event-card:hover {
  opacity: 0.8;
}

.upcoming-event-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
}

.upcoming-event-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.upcoming-event-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  min-width: 0;
}

.upcoming-event-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
}

.upcoming-event-type {
  font-size: 1rem;
  line-height: 1.2;
}

.upcoming-event-countdown {
  font-size: 0.8125rem;
  color: var(--color-text-tertiary);
  line-height: 1.2;
}

.upcoming-event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.upcoming-event-date-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.upcoming-event-date-month {
  font-size: 0.75rem;
  text-transform: uppercase;
  line-height: 1;
}

.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 8px;
}

/* === EVENT MODAL === */
.event-modal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 500px;
}

.event-carousel {
  position: relative;
  min-height: 200px;
  width: 100%;
}

.event-modal-card-item {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  background: var(--color-surface);
  border-radius: 20px;
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 85%;
  max-width: 420px;
}

.event-card-done-btn {
  background: transparent;
  border: none;
  padding: 10px 20px;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  font-family: inherit;
  align-self: center;
}

.event-card-done-btn:hover {
  opacity: 0.85;
}

.event-modal-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.event-modal-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.event-modal-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  line-height: 1.3;
  width: 100%;
}

.event-modal-info {
  font-size: 1rem;
  text-align: center;
  width: 100%;
}

.event-modal-countdown {
  font-size: 0.9375rem;
  color: var(--color-text-tertiary);
  text-align: center;
  width: 100%;
}

/* ========================================================================== */
/* СТАНДАРТНА СИСТЕМА ТЕКСТОВИХ СТИЛІВ MIRAAPP */
/* ========================================================================== */

/* === РОЗМІРИ ТЕКСТУ === */

.text-small {
  font-size: 0.875rem; /* 14px */
}

.text-base {
  font-size: 1rem; /* 16px */
}

.text-large {
  font-size: 1.125rem; /* 18px */
}

.text-title {
  font-size: 1.25rem; /* 20px */
}

.text-title-large {
  font-size: 1.75rem; /* 28px */
}

/* === КОЛЬОРИ ТЕКСТУ === */

.text-primary {
  color: var(--color-text);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-link {
  color: var(--color-primary);
}

.text-danger {
  color: #ff3b30;
}

.text-success {
  color: #34C759;
}

/* === ЖИРНІСТЬ ТЕКСТУ === */

.font-normal {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

/* ========================================================================== */
/* КІНЕЦЬ СТАНДАРТНОЇ СИСТЕМИ */
/* ========================================================================== */

/* === ХЕДЕР === */

.header-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  font-size: 1.125rem;
  color: var(--color-primary);
  font-family: inherit;
}

.header-title {
  flex: 1;
  text-align: center;
}

/* === ІКОНКИ === */

.icon-sm {
  width: 16px;
  height: 16px;
}

/* Edit button icon — mask-image for theme-aware accent color */
.edit-btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  mask-image: url(../assets/icons/ui/edit.svg);
  -webkit-mask-image: url(../assets/icons/ui/edit.svg);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  background-color: var(--color-primary);
  display: inline-block;
}

.icon-base {
  width: 20px;
  height: 20px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-xl {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

/* Settings row icons — accent gradient */
.icon-mask.icon-xl {
  background: linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 55%, #ffffff));
}

#editModeBlock {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
