/* Рабочая версия с входом (live.mjs). Использует токены styles.css: --bg --surface --card --line --text --dim --muted --accent. */

body.live-auth .sidebar,
body.live-auth .topbar,
body.live-auth footer { display: none; }
body.live-auth .workspace-body { margin: 0; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
body.live-auth main { width: 100%; padding: 0; min-height: 0; }

.auth-card { width: min(100%, 420px); margin: 0 auto; padding: 32px 28px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px -24px rgb(0 0 0 / .6); }
.auth-brand { font: 700 22px/1 var(--display); letter-spacing: -.02em; margin-bottom: 28px; }
.auth-brand .brand-dot { color: var(--accent); font-size: .5em; vertical-align: super; margin-left: 2px; }
.auth-card h1 { font: 600 24px/1.2 var(--display); letter-spacing: -.02em; text-wrap: balance; margin: 0 0 8px; }
.auth-card > p { color: var(--dim); margin: 0 0 24px; line-height: 1.5; max-width: 60ch; }
.auth-card form { display: grid; gap: 16px; }
.auth-card .button.primary { width: 100%; justify-content: center; min-height: 48px; }
.auth-card .form-hint { margin: 16px 0 0; }
.password-row { position: relative; display: block; }
.password-row input { width: 100%; padding-right: 88px; }
.password-row .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 12px; background: none; border: 0; color: var(--dim); font: inherit; font-size: 13px; cursor: pointer; border-radius: 8px; }
.password-row .reveal:hover { color: var(--text); background: var(--card); }
.pw-rule { font-size: 13px; color: var(--muted); margin: -6px 0 0; }
.pw-rule.ok { color: var(--accent); }

.live-page { display: grid; gap: 24px; }
.live-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.live-head h1 { font: 600 clamp(26px, 4vw, 34px)/1.1 var(--display); letter-spacing: -.03em; text-wrap: balance; margin: 0; }
.live-head p { color: var(--dim); margin: 8px 0 0; max-width: 62ch; }
.live-head .heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.week-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.week-bar .range { font-weight: 600; min-width: 11ch; }
.day-block { display: grid; gap: 8px; }
.day-block h2 { font: 600 15px/1.3 var(--body); margin: 8px 0 0; color: var(--dim); text-transform: lowercase; }
.day-block h2::first-letter { text-transform: uppercase; }
.day-block.today h2 { color: var(--accent); }
.event-row .event-amount { margin-left: auto; color: var(--dim); font-variant-numeric: tabular-nums; }

.request-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.request-card { display: grid; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; align-content: start; }
.request-card header { display: flex; gap: 8px; justify-content: space-between; align-items: start; }
.request-card h3 { margin: 0; font: 600 17px/1.3 var(--body); text-wrap: balance; }
.request-card .when { color: var(--dim); font-variant-numeric: tabular-nums; }
.request-card .items { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; }
.request-card .card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.section-title { font: 600 18px/1.3 var(--body); margin: 8px 0 -8px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--dim); font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.search-box input { width: 100%; max-width: 420px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { min-height: 44px; padding: 0 16px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--dim); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }

.picker { display: grid; gap: 8px; }
.picker-list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 4px; background: var(--bg); }
.picker-group { padding: 10px 10px 4px; font-size: 12px; color: var(--muted); letter-spacing: .02em; }
.pick-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 10px; min-height: 52px; }
.pick-row:hover { background: var(--card); }
.pick-info strong { display: block; font-weight: 500; }
.pick-info small { color: var(--muted); }
.stepper { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.stepper button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer; }
.stepper button:hover:not(:disabled) { border-color: var(--accent); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper input { width: 52px; height: 40px; text-align: center; border-radius: 10px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.picker .resource-choice { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; min-height: 40px; }
.picker .resource-choice:hover { background: var(--card); }
.picker .resource-choice small { display: block; color: var(--muted); }
.picker-count { font-size: 14px; color: var(--dim); }
.picker-count strong { color: var(--accent); }

.conflicts { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgb(239 148 137 / .1); border: 1px solid rgb(239 148 137 / .35); color: var(--text); }
.conflicts ul { margin: 6px 0 0; padding-left: 18px; color: var(--dim); }

.link-box { display: flex; gap: 8px; align-items: stretch; }
.link-box input { flex: 1; min-width: 0; font-size: 13px; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 12px; }
.admin-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.admin-table select { min-height: 36px; }
.admin-table .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.admin-table tr.off td { opacity: .55; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 12px; }
.gear-request { display: grid; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.gear-request h3 { margin: 0; font: 600 16px/1.3 var(--body); }
.gear-request .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gear-request input[name="note"] { flex: 1; min-width: 180px; }

.nav-badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; text-align: center; }
#bell { position: relative; }
#bell .bell-count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: grid; place-items: center; }

.live-skeleton { height: 72px; border-radius: 14px; background: linear-gradient(100deg, var(--surface) 30%, var(--card) 50%, var(--surface) 70%); background-size: 300% 100%; animation: sk 1.4s ease-in-out infinite; }
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .live-skeleton { animation: none; } }

::selection { background: var(--accent); color: var(--accent-ink); }
.live-page :focus-visible, .auth-card :focus-visible, dialog :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabular, .event-time, .admin-table td { font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr { padding: 12px 0; border-top: 1px solid var(--line); }
  .admin-table td { border: 0; padding: 4px 0; }
  .admin-table .row-actions { justify-content: flex-start; margin-top: 8px; }
}

/* На телефоне основное действие страницы остаётся с подписью: иконка без слова непонятна */
@media (max-width: 640px) {
  .live-head .heading-actions .button { font-size: 14px; padding: 0 18px; min-height: 44px; }
  .live-head .heading-actions .button svg { width: 18px; height: 18px; }
  .live-head .heading-actions { margin-top: 4px; }
}

/* Значок на пункте меню: в нижней панели телефона лежит поверх иконки, а не растягивает пункт */
.sidebar .nav-item { position: relative; }
@media (max-width: 640px) {
  .sidebar .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; }
}
