/* Вариант A «книжный»: тёплая бумага, чернила, янтарный акцент.
   Mobile-first; на десктопе — узкая центрированная колонка. */

:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #26221c;
  --text: #4d463b;
  --muted: #7a7264;
  --faint: #a89e8e;
  --line: #eee3d2;
  --line-soft: #f2ead9;
  --amber: #955f10;
  --amber-dark: #7a4e0c;
  --amber-bg: #fff7e6;
  --amber-line: #ecd9ac;
  --amber-btn-line: #d8c49a;
  --terra: #b3402e;
  --terra-bg: #fdf0ed;
  --terra-line: #eecdc5;
  --chip: #f4ede1;
  --serif: 'PT Serif', Georgia, serif;
  --sans: 'Golos Text', system-ui, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--amber); text-decoration: none; }
a:hover { color: var(--amber-dark); }

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 20px calc(96px + env(safe-area-inset-bottom, 0px)) 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Шапка главной */
.topbar { display: flex; justify-content: space-between; align-items: center; }
.topbar-brand {
  font-size: 13px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: #faf7f2;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.avatar:hover { color: #ffffff; }

/* Профиль */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar-lg {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ink); color: #faf7f2;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.tg-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: #2AABEE;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.link-danger {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px;
  font-size: 15px; font-weight: 500; color: var(--terra);
}
.link-danger:hover { color: var(--terra); }

/* Комментарии */
.comment {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
}
.comment-ava {
  width: 36px; height: 36px; border-radius: 50%;
  background: #efe6d6; color: var(--amber-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.comment-body { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; }
.comment-name { font-size: 14px; font-weight: 600; }
.comment-time { font-size: 12px; color: var(--faint); }
.comment-del-form { margin-left: auto; }
.comment-del {
  width: 36px; height: 36px; margin: -8px -10px -8px 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--faint);
}
.comment-del:hover { color: var(--terra); }
.comment-text { font-size: 14.5px; line-height: 1.5; color: var(--text); overflow-wrap: break-word; }

.comment-form { display: flex; gap: 10px; align-items: flex-end; }
.input {
  flex-grow: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  resize: none;
  min-height: 46px;
}
.input::placeholder { color: var(--faint); }
.send-btn {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--ink); border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Плашка после действия */
.flash {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
}
.flash--ok { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-dark); }
.flash--warn { background: var(--terra-bg); border: 1px solid var(--terra-line); color: var(--terra); }

/* Формы */
form { margin: 0; }
.form-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.input-text {
  width: 100%;
  box-sizing: border-box;
  min-height: 46px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
}
.btn--sm { min-height: 40px; padding: 8px 12px; font-size: 13px; }

/* Раскрывающиеся формы админки */
.dform {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.dform > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  min-height: 48px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}
.dform > summary::-webkit-details-marker { display: none; }
.dform > summary::after { content: '+'; margin-left: auto; color: var(--faint); font-size: 18px; }
.dform[open] > summary::after { content: '–'; }
.dform-body {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 16px 16px 16px;
}

/* Бейджи админки */
.badge--terra { background: var(--terra-bg); border-color: var(--terra-line); color: var(--terra); }
.badge--ink { background: var(--ink); border-color: var(--ink); color: #faf7f2; }
.next-item--off { opacity: 0.55; }

.tabbar.tabbar--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.select {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
}

/* Заглушка входа */
.wrap--bare {
  min-height: 100vh;
  padding-bottom: 32px;
  justify-content: space-between;
}
.login-center {
  display: flex; flex-direction: column; align-items: center;
  gap: 24px; margin-top: 15vh;
}
.login-logo {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.login-title-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.login-title { font-family: var(--serif); font-weight: 700; font-size: 28px; }
.login-sub { font-size: 14px; color: var(--muted); }
.login-foot { text-align: center; font-size: 12px; color: var(--faint); }

/* Карточки */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card--amber { background: var(--amber-bg); border-color: var(--amber-line); padding: 18px; }
.card--terra { background: var(--terra-bg); border-color: var(--terra-line); padding: 18px; }

.label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--amber);
}
.card--terra .label { color: var(--terra); }

.hero-date {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.2;
}

.time-row { display: flex; align-items: center; gap: 8px; }
.time-row svg { flex-shrink: 0; }
.time-main { font-size: 17px; font-weight: 500; }
.time-hint { font-size: 14px; color: var(--faint); }

.chip {
  align-self: flex-start;
  background: var(--chip);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--text);
}

/* Кнопки: тач-таргет от 44px */
.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px;
  background: var(--ink);
  color: #faf7f2;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-family: var(--sans);
  font-size: 15px; font-weight: 500;
  cursor: pointer;
  text-align: center;
}
.btn:hover { color: #ffffff; }
.btn--outline {
  background: var(--card);
  color: var(--amber-dark);
  border: 1.5px solid var(--amber-btn-line);
  min-height: 44px;
  font-size: 14px;
  padding: 10px 14px;
}
.btn--outline:hover { color: var(--amber-dark); }

/* Список ролей */
.section-title { font-family: var(--serif); font-weight: 700; font-size: 19px; }
.section { display: flex; flex-direction: column; gap: 12px; }

.roles {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.role-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.role-row:last-child { border-bottom: 0; }
.role-row--me { background: var(--amber-bg); }
.role-name { font-size: 14px; color: var(--muted); }
.role-user { font-size: 15px; font-weight: 500; text-align: right; }
.role-user--me { font-weight: 600; }
.role-vacant { font-size: 14px; font-weight: 500; color: var(--terra); }
.role-cell { display: flex; align-items: center; gap: 8px; }
.badge-me {
  background: var(--amber); color: #ffffff;
  border-radius: 6px; padding: 2px 6px;
  font-size: 11px; font-weight: 600;
}

/* «Ты ответственен» — строка роли с кнопкой */
.my-duty { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.my-duty-name { font-size: 17px; font-weight: 600; }

/* Ближайшие события списком */
.next-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  color: var(--ink);
}
.next-item:hover { color: var(--ink); }
.next-date { font-size: 15px; font-weight: 500; }
.next-sub { font-size: 13px; color: var(--faint); margin-top: 2px; }
.next-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.badge {
  background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-dark);
  border-radius: 8px; padding: 3px 8px; font-size: 12px; font-weight: 500;
}
.items { display: flex; flex-direction: column; gap: 10px; }

/* Страница события */
.page-head { display: flex; align-items: center; gap: 12px; }
.back-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); flex-shrink: 0;
}
.page-head-title { font-size: 16px; font-weight: 600; }
.h1 { font-family: var(--serif); font-weight: 700; font-size: 24px; }

/* Расписание по месяцам */
.month-title { font-family: var(--serif); font-weight: 700; font-size: 19px; margin-top: 8px; }

.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }
.empty { color: var(--faint); font-size: 15px; text-align: center; padding: 24px 0; }

/* Нижняя навигация */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 8px 0 calc(10px + env(safe-area-inset-bottom, 0px)) 0;
  z-index: 10;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 44px;
  font-size: 11px; font-weight: 500;
  color: var(--faint);
}
.tab:hover { color: var(--muted); }
.tab--active, .tab--active:hover { color: var(--ink); font-weight: 600; }
