@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap");

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: "Nunito", sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 22px;
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
  background-color: #f3f6ff;
}

a {
  text-decoration: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.boxy {
  background-color: #fff;
  box-shadow: 0 4px 18px rgba(55, 72, 140, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(147, 165, 255, 0.18);
  padding: 10px;
}

.boxy-small {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(55, 72, 140, 0.1);
  border-radius: 8px;
  border: 0;
  padding: 5px;
}

/* Top navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid rgba(147, 165, 255, 0.22);
  box-shadow: 0 4px 20px rgba(55, 72, 140, 0.06);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 20px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  flex-shrink: 0;
  order: 1;
}

.topbar-collapse {
  order: 2;
}

.topbar-user {
  order: 3;
}

.topbar-toggle {
  order: 4;
}

.topbar-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 2px 10px rgba(55, 72, 140, 0.1);
}

.topbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-brand-text strong {
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
}

.topbar-brand-text span {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6782e5;
}

.topbar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid #d7def8;
  border-radius: 10px;
  background: #f8faff;
  color: #374151;
  font-size: 1.4rem;
  cursor: pointer;
}

.topbar-collapse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 20px;
  min-width: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  color: #6b7280;
  font-size: 0.92rem;
  font-weight: 700;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.topbar-nav-link i {
  font-size: 1rem;
}

.topbar-nav-link:hover {
  background: #f3f6ff;
  color: #6782e5;
}

.topbar-nav-link.active {
  background: linear-gradient(135deg, rgba(103, 130, 229, 0.14), rgba(147, 165, 255, 0.18));
  color: #4f63c7;
  box-shadow: inset 0 0 0 1px rgba(103, 130, 229, 0.18);
}

.topbar-dropdown {
  position: relative;
}

.topbar-dropdown-toggle {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.topbar-dropdown-caret {
  font-size: 0.7rem;
  opacity: 0.7;
}

.topbar-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 228px;
  padding: 8px 6px 6px;
  background: #fff;
  border: 1px solid #e4e9ff;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(79, 99, 199, 0.16);
  z-index: 40;
}

.topbar-dropdown-menu::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.topbar-dropdown.open .topbar-dropdown-menu {
  display: block;
}

.topbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #4b5563;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.topbar-dropdown-item:hover {
  background: #f3f6ff;
  color: #6782e5;
}

.topbar-dropdown-item.active {
  background: linear-gradient(135deg, rgba(103, 130, 229, 0.14), rgba(147, 165, 255, 0.18));
  color: #4f63c7;
}

@media (min-width: 992px) {
  .topbar-dropdown:hover .topbar-dropdown-menu,
  .topbar-dropdown:focus-within .topbar-dropdown-menu {
    display: block;
  }
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding: 6px 8px 6px 6px;
  border-radius: 999px;
  background: #f8faff;
  border: 1px solid #e4e9ff;
}

.daily-note {
  position: relative;
  flex-shrink: 0;
}

.daily-note-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #4f63c7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.daily-note-btn i {
  font-size: 1.05rem;
  line-height: 1;
}

.daily-note-btn:hover {
  background: #eef2ff;
  color: #3d51b5;
}

.daily-note-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #f8faff;
}

.daily-note-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow: auto;
  background: #fff;
  border: 1px solid #e4e9ff;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(55, 72, 140, 0.16);
  z-index: 40;
  padding: 10px;
}

.daily-note-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid #eef2ff;
}

.daily-note-head strong {
  font-size: 0.92rem;
  color: #111827;
}

.daily-note-head span,
.daily-note-empty {
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
}

.daily-note-empty {
  margin: 12px 6px;
}

.daily-note-section {
  padding-top: 8px;
}

.daily-note-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 6px 4px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #4f63c7;
}

.daily-note-section h3 span {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef2ff;
  text-align: center;
  line-height: 18px;
}

.daily-note-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 8px;
  border-radius: 10px;
  color: inherit;
}

.daily-note-item:hover {
  background: #f3f6ff;
}

.daily-note-item strong {
  font-size: 0.84rem;
  color: #111827;
}

.daily-note-item span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
}

.daily-note-item em {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 700;
  color: #b45309;
}

.user-avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #5b73e8 0%, #93a5ff 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow:
    0 0 0 2px #fff,
    0 4px 12px rgba(91, 115, 232, 0.35);
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-company {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6782e5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-company-select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 160px;
  min-width: 110px;
  padding: 2px 22px 2px 8px;
  border: 1px solid #d7def8;
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236782e5' d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  color: #4f63c7;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.user-company-select:focus {
  outline: none;
  border-color: #93a5ff;
  box-shadow: 0 0 0 2px rgba(103, 130, 229, 0.18);
}

.user-company-select:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #dc3545;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-logout:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.btn-logout i {
  font-size: 1rem;
}

/* Page layout */
.page-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

.main-content {
  background-color: #fff;
  padding: 25px 15px 15px;
  border-radius: 12px;
  min-height: calc(100vh - 120px);
}

.main-content.custom-bg {
  background-color: transparent;
  padding: 0;
  box-shadow: none;
  border: none;
}

.nav-tabs .nav-link {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.6);
}

.nav-tabs .nav-link.active {
  color: #6782e5;
}

.iconic {
  box-shadow: 0 4px 12px rgba(55, 72, 140, 0.12);
  border: none;
}

@media (max-width: 991.98px) {
  .topbar-inner {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 10px 12px;
  }

  .topbar-logo {
    width: 36px;
    height: 36px;
  }

  .topbar-brand-text strong {
    font-size: 0.92rem;
  }

  .topbar-user {
    order: 2;
    width: auto;
    margin-left: auto;
    flex-shrink: 0;
    padding: 3px 4px 3px 3px;
    gap: 6px;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.78rem;
  }

  .user-meta {
    flex: 0 1 auto;
  }

  .user-name,
  .user-company {
    max-width: 88px;
  }

  .user-company-select {
    max-width: 88px;
    min-width: 72px;
  }

  .btn-logout {
    padding: 6px 8px;
  }

  .btn-logout span {
    display: none;
  }

  .topbar-toggle {
    order: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0;
    width: 36px;
    height: 36px;
  }

  .topbar-collapse {
    order: 4;
    display: none;
    flex: 0 0 100%;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #eef2ff;
  }

  .topbar-collapse.show {
    display: flex;
  }

  .topbar-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 2px;
    padding: 0;
  }

  .topbar-nav-link {
    position: relative;
    width: auto;
    flex: 1 1 0;
    max-width: none;
    min-width: 0;
    min-height: 44px;
    justify-content: center;
    padding: 8px 4px;
    border-radius: 10px;
  }

  .topbar-nav-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .topbar-nav-link i {
    font-size: 1.28rem;
  }

  .topbar-nav {
    position: relative;
  }

  .topbar-dropdown {
    position: static;
    flex: 1 1 0;
    min-width: 0;
  }

  .topbar-dropdown .topbar-nav-link {
    width: 100%;
  }

  .topbar-dropdown-caret {
    display: none;
  }

  .topbar-dropdown-menu {
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 0;
    width: 100%;
  }

  .topbar-dropdown-item {
    white-space: normal;
  }

  .page-main {
    padding: 14px;
  }
}

@media (max-width: 575.98px) {
  .topbar-brand-text span {
    display: none;
  }

  .user-meta {
    display: none;
  }

  .topbar-user {
    width: auto;
    margin-left: auto;
    padding: 4px;
    gap: 6px;
  }

  .daily-note-btn {
    width: 32px;
    height: 32px;
  }
}
