:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #122033;
  --muted: #6b7a90;
  --line: #dde5ef;
  --primary: #1f67ff;
  --primary-dark: #154ed0;
  --danger: #d33b3b;
  --danger-dark: #b91c1c;
  --success: #15803d;
  --shadow: 0 18px 40px rgba(18, 32, 51, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f7f9fc 0%, #eef4fb 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
}

main {
  padding: 24px 0 40px;
}

.container {
  width: min(100% - 24px, 1180px);
  margin: 0 auto;
}

.narrow {
  width: min(100% - 24px, 940px);
}

.card {
  background: var(--card);
  border: 1px solid rgba(221, 229, 239, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(221, 229, 239, 0.8);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.site-nav a,
.nav-welcome {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: #eef4ff;
}

.nav-welcome {
  color: var(--muted);
  background: #f8fbff;
}

.nav-logout {
  background: var(--danger);
  color: #fff !important;
}

.nav-logout:hover,
.nav-logout:focus-visible {
  background: var(--danger-dark) !important;
  color: #fff !important;
}

.hamburger {
  display: none;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--text);
  margin: 5px 0;
}

/* AUTH */
.auth-page {
  padding-top: 36px;
}

.auth-page-centered {
  min-height: calc(100vh - 130px);
  display: flex;
  align-items: center;
}

.auth-shell {
  display: grid;
  gap: 20px;
}

.auth-header-center {
  text-align: center;
  margin-bottom: 4px;
}

.auth-header-center h1 {
  margin: 14px 0 8px;
  font-size: clamp(2rem, 5vw, 2.8rem);
}

.auth-header-center p {
  margin: 0;
  color: var(--muted);
}

.auth-logo {
  width: 66px;
  height: 66px;
  margin: 0 auto;
  border-radius: 16px;
}

.auth-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.auth-mini-card {
  min-height: 100%;
}

.auth-switch-text {
  margin: 18px 0 0;
  color: var(--muted);
  text-align: center;
}

.auth-switch-text a {
  color: var(--primary);
  font-weight: 700;
}

.page-heading h1 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.page-heading p {
  color: var(--muted);
  line-height: 1.6;
}

.profile-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

.form-card h2,
.profile-summary h2,
.side-panel h2,
.list-block h3,
.calendar-header-row h2 {
  margin-top: 0;
}

.form-stack {
  display: grid;
  gap: 16px;
}

label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid rgba(31, 103, 255, 0.18);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 700;
  cursor: pointer;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #eef4ff;
  color: var(--text);
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}

.alert {
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-weight: 600;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.page-section {
  padding-top: 12px;
}

.split-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.hours-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 20px;
}

.calendar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.inline-actions,
.actions-wrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.weekdays {
  margin-bottom: 10px;
}

.weekdays div {
  text-align: center;
  padding: 12px 8px;
  background: #f1f5f9;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
}

.day {
  min-width: 0;
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  padding: 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.day.empty {
  background: transparent;
  border: 0;
  cursor: default;
}

.day.selected {
  border-color: var(--primary);
  background: #eaf1ff;
  box-shadow: inset 0 0 0 1px rgba(31, 103, 255, 0.15);
}

.day.today {
  border: 2px solid var(--primary);
  background: #f7fbff;
}

.day.has-entry {
  background: #effaf5;
}

.day-number {
  font-weight: 800;
}

.day-shift {
  font-size: 0.82rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.selected-info,
.totals-box {
  background: #eef4ff;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.totals-box {
  background: #f0fdf4;
  color: var(--success);
  margin-top: 8px;
}

.list-block {
  margin-top: 20px;
}

.list-block-head {
  margin-bottom: 12px;
}

.work-items-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 6px;
}

.work-items {
  display: grid;
  gap: 10px;
}

.work-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fcfdff;
}

.work-item-main,
.work-item-side {
  display: grid;
  gap: 4px;
}

.work-item-main span,
.muted {
  color: var(--muted);
}

.profile-full {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .auth-card-grid,
  .hours-layout,
  .profile-grid,
  .toolbar-grid {
    grid-template-columns: 1fr;
  }

  .split-heading,
  .calendar-header-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 768px) {
  .hamburger {
    display: inline-block;
  }

  .site-nav {
    position: absolute;
    top: 76px;
    left: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 10px;
    display: none;
  }

  .site-nav.open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav a,
  .nav-welcome {
    width: 100%;
  }

  .calendar-grid {
    gap: 6px;
  }

  .weekdays div,
  .day {
    padding: 8px;
    border-radius: 10px;
  }

  .day {
    min-height: 76px;
  }

  .day-shift {
    font-size: 0.72rem;
  }

  .work-items-scroll {
    max-height: 300px;
  }
}

@media (max-width: 560px) {
  .container,
  .narrow {
    width: min(100% - 16px, 100%);
  }

  .card {
    padding: 16px;
  }

  main {
    padding-top: 16px;
  }
}