:root {
  --bg: #f2f4f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #5f6b85;
  --border: rgba(15, 23, 42, 0.1);
  --brand: #0d5bd4;
  --brand-2: #1f9ad6;
  --danger: #c62828;
  --shadow: 0 14px 34px rgba(10, 37, 64, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(13, 91, 212, 0.09), transparent 32%),
    radial-gradient(circle at 88% 18%, rgba(31, 154, 214, 0.08), transparent 34%),
    var(--bg);
  color: var(--ink);
  max-width: 100%;
  overflow-x: hidden;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 520px);
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.auth-card {
  backdrop-filter: blur(2px);
}

.brand-mark {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(13, 91, 212, 0.25);
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 14px;
}

.form-control,
.form-select,
.btn {
  border-radius: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: 0;
}

.btn-primary:hover {
  filter: brightness(1.04);
}

.app-nav {
  background: linear-gradient(120deg, #0f295f, #0d5bd4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.app-nav .navbar-brand {
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.app-nav .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
}

.app-nav .navbar-toggler-icon {
  filter: invert(1);
}

.app-nav .nav-link {
  color: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 8px 14px;
}

.app-nav .nav-link.is-active,
.app-nav .nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.app-nav .nav-group-spacer {
  width: 1px;
  height: 26px;
  margin: 0 10px;
  align-self: center;
  background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 991.98px) {
  .app-nav .nav-group-spacer {
    display: none;
  }
}

.page-shell {
  padding: 26px 0 40px;
}

.page-title {
  margin: 0;
  font-size: clamp(1.35rem, 1.2rem + 0.7vw, 2rem);
}

.page-subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.kpi-item {
  background: linear-gradient(145deg, #ffffff, #f9fbff);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.kpi-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.calendar-layout-guest {
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
}

.calendar-layout-spacious {
  margin-top: 18px;
}

@media (max-width: 1024px) {
  .calendar-layout,
  .calendar-layout-guest {
    grid-template-columns: 1fr;
  }
}

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

.calendar-head {
  color: var(--muted);
  text-align: center;
  font-weight: 600;
  font-size: 0.86rem;
}

.calendar-cell {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.calendar-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.calendar-cell-clickable {
  cursor: pointer;
}

.calendar-cell.outside {
  opacity: 0.47;
}

.calendar-cell-past {
  background: #f3f5fa;
  border-style: dashed;
}

.calendar-day {
  font-weight: 700;
}

.calendar-day-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-dow-mobile {
  display: none;
  color: var(--muted);
  font-size: 0.76rem;
}

.calendar-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  color: #fff;
}

.pill-archived {
  filter: grayscale(0.75);
  opacity: 0.85;
}

.event-list-scroll {
  max-height: 540px;
  overflow: auto;
}

.calendar-main-column {
  min-width: 0;
}

.calendar-side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.calendar-side-panel .event-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 540px;
}

.day-events-scroll {
  max-height: min(65vh, 620px);
  overflow: auto;
}

.event-tile {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: linear-gradient(145deg, #ffffff, #f7faff);
}

.event-tile h6 {
  margin: 0 0 6px;
}

.event-desc-clamp {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-chip {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-TO_REVIEW { background: #f9e2ae; color: #7a4f00; }
.status-APPROVED { background: #c5f2d2; color: #075e2f; }
.status-DECLINED { background: #f7ccd2; color: #8b1b2a; }
.status-IN_PROGRESS { background: #b7def7; color: #114f8f; }
.status-DONE { background: #d7dde8; color: #334155; }

.table thead th {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.events-table-wrap {
  overflow-y: visible;
}

.panel-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filters-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.filters-wrap-spacious {
  margin-bottom: 24px;
}

.calendar-period-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.calendar-period-field {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.calendar-period-select {
  min-width: 140px;
}

.person-suggest-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  max-height: 260px;
  overflow-y: auto;
}

.person-suggest-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 10px;
  min-height: 48px;
}

.person-suggest-item + .person-suggest-item {
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.person-suggest-item:hover,
.person-suggest-item:focus-visible {
  background: #eef4ff;
}

.person-suggest-email {
  font-weight: 600;
  font-size: 0.88rem;
}

.person-suggest-name,
.person-suggest-departments {
  font-size: 0.76rem;
  color: var(--muted);
}

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

.assignee-item-main {
  min-width: 0;
}

.assignee-item-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 190px;
}

.response-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.response-card {
  width: min(100%, 620px);
}

.public-hero {
  background: linear-gradient(130deg, #0f295f, #1f9ad6);
  color: #fff;
  border-radius: 20px;
  padding: 20px;
}

.site-footer {
  margin-top: 28px;
  padding: 16px 0 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-admin-link {
  display: inline-block;
  margin-left: 6px;
  font-weight: 600;
  text-decoration: none;
}

.footer-admin-link:hover {
  text-decoration: underline;
}

.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.42);
  padding: 16px;
}

.app-confirm-overlay[hidden] {
  display: none;
}

.app-confirm-dialog {
  width: min(100%, 460px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.32);
  padding: 16px;
}

.app-confirm-title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  font-weight: 700;
}

.app-confirm-message {
  margin: 0;
  color: var(--muted);
}

.app-confirm-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.app-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 4100;
  display: grid;
  gap: 8px;
  width: min(92vw, 360px);
}

.app-toast {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
  padding: 10px 12px;
  font-size: 0.9rem;
}

.app-toast-danger {
  border-color: rgba(198, 40, 40, 0.35);
  background: #fff5f5;
}

.app-toast-success {
  border-color: rgba(0, 168, 120, 0.35);
  background: #f3fff9;
}

.department-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  cursor: pointer;
  background: #fff;
}

.entity-collapse-toggle {
  cursor: pointer;
}

.entity-collapse-toggle:hover {
  background: rgba(13, 91, 212, 0.05);
  border-radius: 10px;
}

.department-card .form-check-input {
  margin: 0;
  position: static;
  float: none;
}

.person-list-scroll {
  max-height: 460px;
  overflow: auto;
  padding-right: 6px;
}

@media (max-width: 992px) {
  .calendar-weekdays {
    display: none;
  }

  .calendar-days {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .calendar-cell {
    min-height: 128px;
    padding: 10px;
  }

  .calendar-dow-mobile {
    display: inline;
  }
}

@media (max-width: 768px) {
  .calendar-period-form {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .calendar-period-field {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-period-select {
    width: 100%;
    min-width: 0;
  }

  .calendar-days {
    grid-template-columns: 1fr;
  }

  .calendar-cell {
    min-height: 138px;
  }

  .assignee-item {
    flex-direction: column;
    align-items: stretch;
  }

  .assignee-item-controls {
    width: 100%;
    min-width: 0;
    align-items: stretch;
  }
}
