/* Витрина сервисов. Тёплая песочная тема (согласована с макетом дизайнера). */

* { box-sizing: border-box; }
html, body { margin: 0; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 44px 32px 56px;
  background: #ccc3b4;
  font-family: 'Golos Text', system-ui, sans-serif;
}

.board {
  width: 1180px;
  max-width: 100%;
  padding: 40px 48px 56px;
  border-radius: 28px;
  background: radial-gradient(115% 90% at 50% 0%, #f3ede1 0%, #e6ddcd 100%);
  box-shadow: 0 30px 70px rgba(58, 46, 32, 0.14);
}

/* --- Шапка --- */
.head { margin: 0 0 40px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end; /* десктоп: действия справа */
  gap: 12px;
  min-height: 34px;
}

/* Бренд слева (логотип + подпись) — показывается только на мобильном */
.brand { display: none; align-items: center; gap: 9px; min-width: 0; margin-right: auto; }
.brand-logo { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }
.brand-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #a2917d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head-actions { display: flex; align-items: center; gap: 14px; }
.head-link { font-size: 13px; font-weight: 600; color: #9a5c52; text-decoration: none; }
.head-link:hover { color: #7d453d; }
.inline-form { margin: 0; }
.head-logout {
  border: 1px solid rgba(120, 100, 80, 0.28);
  background: transparent;
  color: #82796f;
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.head-logout:hover { color: #4a3c2c; border-color: rgba(120, 100, 80, 0.5); }

/* Круглый аватар-кнопка (инициалы) — только на мобильном, открывает шторку */
.avatar {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(122, 95, 60, 0.24);
  background: rgba(255, 255, 255, 0.5);
  color: #9a5c52;
  cursor: pointer;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar:hover { background: #fffdfa; border-color: rgba(122, 95, 60, 0.44); }

.hero { text-align: center; margin-top: 8px; }
.logo { width: 92px; height: auto; display: block; margin: 0 auto 16px; }
.title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 45px;
  line-height: 1.02;
  color: #39312b;
  letter-spacing: 0.3px;
}
.subtitle {
  margin-top: 12px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 4px;
  color: #a89a88;
}
/* Имя вошедшего под заголовком — показывается только на мобильном */
.username { display: none; margin-top: 7px; font-size: 12px; font-weight: 500; color: #a89a88; }

/* Аккаунт-шторка по умолчанию скрыта (включается в мобильном медиазапросе) */
.acct-overlay, .acct-sheet { display: none; }

/* --- Разделы и сетка --- */
.group { margin-bottom: 28px; }
.group-head { display: flex; align-items: center; gap: 14px; margin: 0 0 15px; }
.group-label {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #a2917d;
  white-space: nowrap;
}
.group-rule { flex: 1; height: 1px; background: rgba(120, 100, 80, 0.18); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
/* Три колонки держим как можно дольше; ужимаемся только на узких экранах. */
@media (max-width: 760px) { .grid { grid-template-columns: repeat(2, 1fr); } }

/* --- Мобильный вид (телефоны): по образцу мобильного макета --- */
@media (max-width: 560px) {
  .page { padding: 16px 12px 28px; align-items: flex-start; }
  .board { width: 100%; padding: 8px 16px 28px; border-radius: 26px; }

  /* Шапка: слева бренд, справа аватар; десктопные ссылки прячем */
  .topbar { justify-content: space-between; padding-top: 6px; }
  .brand { display: flex; }
  .head-actions { display: none; }
  .avatar { display: flex; }

  .head { margin-bottom: 6px; }
  .hero { margin-top: 4px; }
  .logo { width: 46px; margin-bottom: 9px; }
  .title { font-size: 27px; }
  .subtitle { display: none; }
  .username { display: block; }

  .group { margin-bottom: 24px; }
  .group-head { margin-bottom: 12px; }

  /* Одна колонка, крупные тапабельные плитки */
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .tile { gap: 16px; padding: 16px 18px; border-radius: 18px; min-height: 84px; }
  .tile-icon { flex: 0 0 60px; width: 60px; height: 60px; }
  .tile-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 23px;
    line-height: 1.06;
    letter-spacing: 0.2px;
  }

  /* --- Аккаунт-шторка (выезжает снизу по тапу на аватар) --- */
  .acct-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(42, 29, 20, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .acct-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: #fffdfa;
    border-radius: 24px 24px 0 0;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 50px rgba(42, 29, 20, 0.22);
    transform: translateY(105%);
    transition: transform 0.26s cubic-bezier(.2, .7, .3, 1);
  }
  .acct-toggle:checked ~ .acct-overlay { opacity: 1; pointer-events: auto; }
  .acct-toggle:checked ~ .acct-sheet { transform: translateY(0); }

  .acct-handle { width: 44px; height: 5px; border-radius: 3px; background: #e4d8c5; margin: 0 auto 16px; }
  .acct-user { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
  .acct-ava {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #9a5c52;
    color: #f6ece1;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .acct-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.1;
    color: #2c2621;
  }
  .acct-actions { display: flex; flex-direction: column; gap: 9px; }
  .acct-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(122, 95, 60, 0.18);
    background: #fdf9f2;
    border-radius: 14px;
    padding: 15px;
    min-height: 54px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: #9a5c52;
    text-decoration: none;
    cursor: pointer;
  }
  .acct-item:hover { border-color: rgba(122, 95, 60, 0.4); color: #7d453d; }
  /* Пункт с пояснением второй строкой («Включить вход без пароля»). */
  .acct-item-two { flex-direction: column; gap: 3px; }
  .acct-item-two small { font-size: 12.5px; font-weight: 400; color: #82796f; }
  .acct-item-muted { color: #6e5c4e; font-weight: 500; }
  .acct-close {
    display: block;
    text-align: center;
    width: 100%;
    margin-top: 14px;
    padding: 13px;
    min-height: 48px;
    font-size: 14.5px;
    font-weight: 600;
    color: #8a7a6c;
    cursor: pointer;
  }
}

/* --- Плитка --- */
.tile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: 20px;
  padding: 22px 24px;
  border: 1px solid rgba(120, 100, 80, 0.06);
  box-shadow: 0 10px 30px rgba(74, 60, 44, 0.07), 0 2px 6px rgba(74, 60, 44, 0.045);
  text-decoration: none;
  color: inherit;
  transition: transform .22s ease, box-shadow .22s ease;
}
.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(74, 60, 44, 0.13), 0 3px 8px rgba(74, 60, 44, 0.06);
}

.tile-icon {
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile-icon img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tile-letter {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Vollkorn', Georgia, serif;
  font-weight: 700;
  font-size: 30px;
}

.tile-text { min-width: 0; flex: 1 1 auto; }
.tile-title {
  font-family: 'Vollkorn', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.12;
  /* Фирменный тёплый акцент (он же у кнопки входа и ссылок). */
  color: #9a5c52;
  /* Переносим длинные названия («Календарь клиники»), а не обрезаем —
     иначе в трёх колонках имена режутся многоточием. */
  overflow-wrap: break-word;
}
.tile-caption { margin-top: 6px; font-size: 14px; line-height: 1.35; color: #82796f; }

/* Сообщение над плитками (итог «Включить вход без пароля»). */
.notice {
  margin: 0 0 28px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.45;
  text-align: center;
}
.notice-ok { background: #e7eee8; color: #3c5548; }
.notice-warn { background: #f6e3df; color: #7d453d; }

.empty {
  text-align: center;
  color: #82796f;
  font-size: 15px;
  padding: 40px 0;
}

/* --- Приветственная страница входа --- */
.page-center { align-items: center; }
.board-login {
  width: 520px;
  text-align: center;
  padding: 52px 48px 48px;
}
.board-login .logo { width: 104px; margin-bottom: 18px; }
.login-lead {
  margin: 22px auto 30px;
  max-width: 380px;
  font-size: 15px;
  line-height: 1.5;
  color: #82796f;
}
/* Вход сорвался на обратном пути из Keycloak — просим нажать «Войти» ещё раз. */
.login-error {
  margin: -8px auto 24px;
  max-width: 380px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #f6e3df;
  color: #7d453d;
  font-size: 14px;
  line-height: 1.45;
}
.login-btn {
  display: inline-block;
  padding: 14px 44px;
  border-radius: 999px;
  background: #9a5c52;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(122, 69, 61, 0.28);
  transition: background .18s ease, transform .18s ease;
}
.login-btn:hover { background: #7d453d; transform: translateY(-2px); color: #fff; }
.login-forgot { margin: 22px 0 0; font-size: 14px; }
.login-forgot a { color: #9a5c52; }
.login-forgot a:hover { color: #7d453d; }
