:root {
  --page-bg: #232323;
  --shell: #1a1f26;
  --panel: #242a33;
  --panel-2: #1d232c;
  --line: #2f3642;
  --line-soft: #333b48;
  --text: #edf2f6;
  --muted: #9da7b3;
  --accent: #e67e22;
  --accent-2: #f39c34;
  --ok: #f08b2c;
  --crowd: #d8741b;
  --weekend: #ffb36b;
  --shadow: 0 14px 32px rgba(8, 12, 18, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Manrope', 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(243, 156, 52, 0.08), transparent 34%),
    radial-gradient(circle at 86% 88%, rgba(230, 126, 34, 0.06), transparent 36%),
    var(--page-bg);
}

.app {
  max-width: 1180px;
  margin: 30px auto;
  padding: 18px;
  display: grid;
  gap: 14px;
  border-radius: 28px;
  background: linear-gradient(180deg, #1b2027, #191e25);
  border: 1px solid #2b323d;
  box-shadow: 0 20px 60px rgba(7, 11, 17, 0.5);
}

.hero,
.controls,
.admin-controls,
.calendar-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 22px;
}

.logo-wrap {
  display: grid;
  gap: 10px;
}

.logo-image {
  display: none;
  max-width: min(760px, 100%);
  width: 100%;
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}

.logo-text {
  font-family: 'Manrope', sans-serif;
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f4f8fb;
  text-shadow: 0 5px 16px rgba(0, 0, 0, 0.42);
}

.logo-subtitle {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1rem, 2.3vw, 1.15rem);
  color: var(--muted);
}

.hero-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.controls,
.admin-controls,
.calendar-section {
  padding: 14px;
}

.controls {
  display: grid;
  gap: 10px;
}

.login-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.login-status {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.picker-title {
  margin: 0;
  font-weight: 700;
  color: #d9e2ea;
}

.user-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-btn {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8edf2;
  background: var(--panel-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.user-btn:hover {
  transform: translateY(-1px);
  border-color: #46505f;
}

.user-btn.selected {
  border-color: #d47924;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #2b1602;
  box-shadow: 0 8px 18px rgba(230, 126, 34, 0.28);
}

.active-user {
  margin: 0;
  color: var(--muted);
}

.stats {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  min-width: 300px;
  margin-left: auto;
}

.stats-title {
  margin: 0;
  font-weight: 700;
  color: #e3e9ee;
}

.best-day-text {
  margin: 0;
  color: #ffd6a8;
  font-weight: 700;
}

.admin-controls {
  display: grid;
  gap: 8px;
}

.admin-title {
  margin: 0;
  font-weight: 700;
  color: #ffd1a3;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-row input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  color: #eef1f4;
  background: var(--panel-2);
}

.admin-row input:focus {
  outline: 2px solid rgba(230, 126, 34, 0.45);
  outline-offset: 1px;
}

.btn,
.month-btn,
.day {
  border: none;
  cursor: pointer;
}

.btn,
.month-btn {
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn:hover,
.month-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.btn {
  font-weight: 700;
  color: #2b1602;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 10px 18px rgba(230, 126, 34, 0.22);
}

.danger-btn {
  color: #fff8f8;
  background: linear-gradient(180deg, #ff7e71, #d94c40);
}

.calendar-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.calendar-head h2 {
  margin: 0;
  text-align: center;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  color: #edf3f8;
  text-transform: capitalize;
}

.month-btn {
  height: 44px;
  border-radius: 12px;
  color: #dce7f0;
  font-size: 1.25rem;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
}

.weekdays,
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekdays {
  margin-bottom: 6px;
  font-weight: 700;
  text-align: center;
  color: #b5bfc9;
}

.weekend-label {
  color: var(--weekend);
}

.day {
  min-height: 104px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 8px;
  background: var(--panel-2);
  display: grid;
  align-content: start;
  gap: 4px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.day:hover {
  transform: translateY(-1px);
  border-color: #4d5968;
}

.day.empty {
  background: #202731;
  border-style: dashed;
  cursor: default;
}

.day-number {
  font-weight: 700;
  color: #ecf3f9;
}

.day-count {
  font-size: 0.82rem;
  color: #9ba8b5;
}

.day-names {
  font-size: 0.78rem;
  color: #c4cdd7;
  line-height: 1.18;
  max-height: 4.8em;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.names-popover {
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  padding: 8px;
  font-size: 0.72rem;
  line-height: 1.2;
  color: #eef3f7;
  background: rgba(11, 15, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
  overflow: auto;
  display: none;
  z-index: 2;
  -webkit-user-select: none;
  user-select: none;
}

.day.show-names .names-popover {
  display: block;
}

.day.mine {
  border-color: #d47924;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 18px rgba(230, 126, 34, 0.22);
}

.day.mine .day-number,
.day.mine .day-count,
.day.mine .day-names {
  color: #2b1602;
}

.day.crowd {
  background: rgba(230, 126, 34, 0.14);
  border-color: #8e5925;
}

.day.weekend {
  background: rgba(255, 179, 107, 0.1);
}

.day.weekend .day-number {
  color: #ffb36b;
}

.day.weekend.mine {
  border-color: #d47924;
}

.day.mine.crowd,
.day.weekend.mine.crowd {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.day.best-day {
  border-color: #ffd48b;
  box-shadow:
    0 0 0 2px rgba(255, 212, 139, 0.45),
    0 0 18px rgba(243, 156, 52, 0.35),
    inset 0 0 0 1px rgba(255, 223, 171, 0.4);
}

.top-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: #0f141b;
  border-radius: 7px;
  padding: 3px 7px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  z-index: 3;
  line-height: 1;
  pointer-events: none;
}

@media (max-width: 980px) {
  .app {
    margin: 18px;
    padding: 14px;
    border-radius: 22px;
  }

  .logo-text {
    letter-spacing: 0.04em;
  }
}

@media (max-width: 700px) {
  .app {
    margin: 10px;
    padding: 10px;
    border-radius: 20px;
  }

  .hero,
  .controls,
  .calendar-section,
  .admin-controls {
    border-radius: 12px;
  }

  .hero {
    padding: 14px;
  }

  .logo-text {
    font-size: clamp(1.8rem, 10vw, 2.8rem);
    letter-spacing: 0.03em;
  }

  .hero-info {
    flex-direction: column;
  }

  .stats {
    min-width: 0;
    width: 100%;
    margin-left: 0;
  }

  .controls,
  .calendar-section,
  .admin-controls {
    padding: 10px;
  }

  .user-picker {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .user-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 8px 10px;
  }

  .calendar-head {
    grid-template-columns: 38px 1fr 38px;
    gap: 6px;
  }

  .calendar-head h2 {
    font-size: 1.2rem;
  }

  .month-btn {
    height: 38px;
    font-size: 1.05rem;
  }

  .weekdays,
  .calendar {
    gap: 4px;
  }

  .weekdays {
    font-size: 0.88rem;
  }

  .day {
    min-height: 0;
    aspect-ratio: 1 / 1;
    padding: 6px;
    border-radius: 10px;
  }

  .day-number {
    font-size: 0.95rem;
  }

  .day-count {
    font-size: 0.67rem;
    line-height: 1.15;
  }

  .day-names {
    display: none;
  }

  .names-popover {
    inset: 5px;
    padding: 6px;
    font-size: 0.62rem;
  }

  .top-badge {
    top: 4px;
    right: 4px;
    font-size: 0.56rem;
    padding: 2px 5px;
  }

  .admin-row {
    flex-direction: column;
  }

  .admin-row input,
  .admin-row .btn {
    width: 100%;
  }
}
