/* Каркас: сброс, типографика, меню (ПК), верхняя строка и нижняя панель (телефон, планшет). */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-m) / var(--lh) var(--font);
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
}

h1 {
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.25;
}

h2 {
  font-size: var(--fs-l);
  font-weight: 600;
}

h3 {
  font-size: var(--fs-m);
  font-weight: 600;
}

p {
  margin: 0 0 var(--s3);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r1);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: var(--s3);
  top: -100px;
  z-index: 100;
  padding: var(--s2) var(--s4);
  background: var(--card);
  border-radius: var(--r1);
}

.skip-link:focus {
  top: var(--s3);
}

/* иконки из спрайта */
.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.base-svgs {
  display: none;
}

/* ---------- оболочка ---------- */

.app {
  min-height: 100vh;
}

.side {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s3);
  height: 52px;
  padding: 0 var(--s4);
  background: var(--nav);
  color: var(--nav-text-hover);
}

.topbar .brand {
  margin-right: auto;
}

.topbar-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin-left: calc(var(--s2) * -1);
  color: inherit;
  border-radius: var(--r2);
}

.topbar-back.is-on {
  display: inline-flex;
}

.topbar-back:hover {
  text-decoration: none;
  background: var(--nav-active);
}

.topbar-title {
  margin: 0;
  font-size: var(--fs-l);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  color: var(--nav-text-hover);
  font-weight: 600;
  font-size: var(--fs-l);
}

.brand:hover {
  text-decoration: none;
}

.logo {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--logo);
  color: #fff;
  border-radius: var(--r1);
  font-size: var(--fs-s);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.main {
  min-width: 0;
}

.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s4) var(--s4) var(--s6);
  outline: none;
}

/* нижняя панель */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: var(--s1) var(--s1);
  border: 0;
  background: none;
  color: var(--text2);
  font: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
}

.tab:hover {
  text-decoration: none;
  color: var(--text);
}

.tab.is-current {
  color: var(--accent);
  font-weight: 600;
}

.app {
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

/* лист «Ещё» */
.sheet {
  width: 100%;
  max-width: none;
  margin: auto 0 0;
  padding: var(--s2) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
  border: 0;
  border-radius: var(--r2) var(--r2) 0 0;
  background: var(--card);
  color: var(--text);
}

.sheet::backdrop {
  background: var(--scrim);
}

.sheet-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
}

.sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sheet-link,
.sheet-list button {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s2);
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sheet-link:hover {
  text-decoration: none;
  background: var(--sub);
}

.sheet-who {
  margin: 0;
  color: var(--text2);
  font-size: var(--fs-s);
}

/* служебная информация */
.foot {
  margin-top: var(--s6);
  color: var(--text2);
  font-size: var(--fs-xs);
}

/* ---------- ПК ---------- */

@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    padding-bottom: 0;
  }

  .side {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: var(--s4) var(--s3);
    background: var(--nav);
    color: var(--nav-text);
    overflow-y: auto;
  }

  .side .brand {
    padding: var(--s1) var(--s2) var(--s4);
  }

  .topbar,
  .tabbar {
    display: none;
  }

  .content {
    padding: var(--s5) var(--s6) var(--s6);
  }
}

.nav {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.nav-group {
  margin: var(--s4) var(--s2) var(--s1);
  color: var(--nav-text);
  opacity: 0.7;
  font-size: var(--fs-xs);
}

.nav a {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--ctl-h);
  padding: 0 var(--s3);
  border-radius: var(--r1);
  color: var(--nav-text);
  font-size: var(--fs-m);
}

.nav a:hover {
  background: var(--nav-active);
  color: var(--nav-text-hover);
  text-decoration: none;
}

.nav a:focus-visible,
.side-who button:focus-visible {
  box-shadow: 0 0 0 3px var(--focus-nav);
}

body.model-survey .nav [data-nav="survey"],
body.model-completion .nav [data-nav="completion"],
body.model-employee .nav [data-nav="employee"],
body.model-position .nav [data-nav="position"],
body.model-hotel .nav [data-nav="hotel"],
body.dashboard .nav [data-nav="index"] {
  background: var(--nav-active);
  color: var(--nav-text-hover);
  font-weight: 600;
}

.side-who {
  margin-top: auto;
  padding: var(--s3) var(--s2) 0;
  border-top: 1px solid var(--nav-active);
  font-size: var(--fs-s);
}

.side-who p {
  margin: 0 0 var(--s2);
  color: var(--nav-text);
  overflow-wrap: anywhere;
}

.side-who button {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: var(--ctl-h);
  padding: 0 var(--s3);
  border: 1px solid var(--nav-active);
  border-radius: var(--r1);
  background: none;
  color: var(--nav-text-hover);
  font: inherit;
  cursor: pointer;
}

.side-who button:hover {
  background: var(--nav-active);
}

/* ---------- вход ---------- */

body.login {
  min-height: 100vh;
}

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--s4);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: var(--s5);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  box-shadow: var(--shadow);
}

.login-card .brand {
  color: var(--text);
  margin-bottom: var(--s5);
}

.login-card h1 {
  margin-bottom: var(--s4);
}

.login-card .field + .field {
  margin-top: var(--s4);
}

.login-card .btn {
  width: 100%;
  margin-top: var(--s5);
}

@media (min-width: 1024px) {
  .sheet-only {
    display: none;
  }
}
