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

.nav-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) 56px;
  width: 76px;
  max-width: calc(100vw - 20px);
  max-height: calc(100svh - 24px);
  overflow: hidden;
  position: fixed;
}

.nav-panel:hover,
.nav-panel:focus-within,
body.sidebar-open .nav-panel {
  width: min(720px, calc(100vw - 32px));
}

.nav-panel .profile,
.nav-panel .category-grid,
.nav-panel .quick-section,
.nav-panel .panel-footer {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.nav-panel .profile {
  padding-inline: 24px;
}

.profile-copy,
.category-card > span,
.link-open {
  min-width: 0;
}

.profile-copy h1,
.profile-copy p,
.category-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-panel .category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 24px 18px;
  overflow: hidden;
}

.category-card,
.quick-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.quick-section {
  position: relative;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 20px 24px 18px;
  scrollbar-width: thin;
}

.quick-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

body.light-theme .quick-section::before {
  background: rgba(255, 255, 255, 0.5);
}

.section-title {
  flex: 0 0 auto;
  min-width: 0;
}

.favorite-view-button {
  height: 28px;
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: rgba(245, 247, 250, 0.72);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 10px;
  line-height: 1;
}

.favorite-view-button.active,
.favorite-view-button:hover {
  color: rgba(245, 247, 250, 0.92);
  background: rgba(255, 255, 255, 0.12);
}

body.light-theme .favorite-view-button {
  border-color: rgba(255, 255, 255, 0.62);
  color: rgba(31, 36, 48, 0.62);
  background: rgba(255, 255, 255, 0.42);
}

body.light-theme .favorite-view-button.active,
body.light-theme .favorite-view-button:hover {
  color: #1e2430;
  background: rgba(255, 255, 255, 0.72);
}

.quick-grid {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  align-content: start;
}

.nav-panel .quick-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.quick-card {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.link-card {
  padding: 0;
}

.link-open {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 12px;
  text-align: center;
}

.quick-card .brand {
  flex: 0 0 auto;
  margin: 0;
}

.quick-card strong,
.quick-card small {
  width: 100%;
  max-width: 100%;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.quick-card strong {
  line-height: 1.35;
  min-height: 1.35em;
}

.quick-card small {
  margin-top: 0;
  line-height: 1.25;
  min-height: 1.25em;
}

button.quick-card {
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px;
  text-align: center;
}

.delete-link {
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  font-size: 14px;
}

.favorite-link {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(245, 247, 250, 0.62);
  cursor: pointer;
  background: rgba(20, 22, 28, 0.62);
  padding: 0;
  line-height: 1;
  font-size: 14px;
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease, color 160ms ease;
}

.link-card:hover .favorite-link,
.favorite-link:focus-visible,
.favorite-link.active {
  opacity: 1;
}

.favorite-link.active {
  color: #d3a18a;
}

body.light-theme .favorite-link {
  border-color: rgba(255, 255, 255, 0.38);
  color: rgba(31, 36, 48, 0.56);
  background: rgba(255, 255, 255, 0.38);
}

body.light-theme .favorite-link.active {
  color: #9a6b55;
}

.panel-footer {
  min-width: 0;
  max-width: 100%;
  height: 56px;
  min-height: 56px;
  margin-top: 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
  flex: 0 1 auto;
}

.footer-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
  white-space: nowrap;
  min-width: 0;
}

.footer-button svg {
  flex: 0 0 auto;
}

.time-row {
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
}

.hero-title-wrap {
  position: relative;
  display: inline-block;
  isolation: isolate;
}

.hero-title-wrap::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -14px -42px -10px -28px;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 78% 50%,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.1) 38%,
    rgba(255, 255, 255, 0) 72%
  );
  filter: blur(20px);
}

.hero-title {
  -webkit-text-stroke: 0;
  text-shadow: none;
}

body.light-theme .hero-title-wrap::before {
  background: radial-gradient(
    ellipse at 78% 50%,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.12) 38%,
    rgba(255, 255, 255, 0) 72%
  );
}

body.light-theme .hero-title {
  color: rgba(28, 32, 42, 0.94);
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.nav-panel:not(:hover):not(:focus-within):not(.is-open) .footer-actions,
body:not(.sidebar-open) .nav-panel:not(:hover):not(:focus-within) .footer-actions,
body:not(.sidebar-open) .nav-panel:not(:hover):not(:focus-within) .time-row .divider,
body:not(.sidebar-open) .nav-panel:not(:hover):not(:focus-within) .time-row #date {
  display: none;
}

body:not(.sidebar-open) .nav-panel:not(:hover):not(:focus-within) .panel-footer {
  justify-content: center;
  padding: 0;
}

body:not(.sidebar-open) .nav-panel:not(:hover):not(:focus-within) .time-row {
  width: 100%;
  justify-content: center;
  font-size: 12px;
  color: rgba(245, 247, 250, 0.66);
}

body.light-theme:not(.sidebar-open) .nav-panel:not(:hover):not(:focus-within) .time-row {
  color: rgba(31, 36, 48, 0.58);
}

@media (max-height: 760px) and (min-width: 761px) {
  .nav-panel .quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-card {
    height: 88px;
    min-height: 0;
  }

  .quick-section {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .section-title {
    margin-bottom: 10px;
  }
}

@media (max-width: 760px) {
  .nav-panel {
    max-width: calc(100vw - 16px);
  }

  .nav-panel:hover,
  .nav-panel:focus-within,
  body.sidebar-open .nav-panel {
    width: calc(100vw - 16px);
  }

  .nav-panel .category-grid,
  .nav-panel .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-section {
    padding-inline: 18px;
  }

  .quick-section::before {
    left: 18px;
    right: 18px;
  }

  .quick-card {
    height: 92px;
  }

  .panel-footer {
    padding-inline: 18px;
  }
}

/* Dialog dropdown containment. */
.modal {
  overflow: visible;
}

.modal-card {
  overflow: visible;
  max-height: min(760px, calc(100vh - 48px));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.custom-select {
  position: relative;
  z-index: 8;
}

.custom-select-menu {
  box-sizing: border-box;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  max-height: 150px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.custom-select.is-open {
  z-index: 20;
}

@media (max-height: 680px) {
  .custom-select-menu {
    max-height: 118px;
  }
}

/* Keep the dialog category dropdown inside the form flow. */
.modal .custom-select-menu {
  position: static;
  width: 100%;
  max-width: 100%;
  max-height: 0;
  margin-top: 0;
  border-width: 0;
  padding: 0 6px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
  transform: none;
  transition:
    max-height 180ms ease,
    opacity 160ms ease,
    margin-top 160ms ease,
    padding 160ms ease;
}

.modal .custom-select.is-open .custom-select-menu {
  max-height: 148px;
  margin-top: 8px;
  border-width: 1px;
  padding: 6px;
  opacity: 1;
  pointer-events: auto;
  overflow-x: hidden;
  overflow-y: auto;
  transform: none;
}

.modal .custom-select-menu::-webkit-scrollbar {
  width: 8px;
  height: 0;
}

.modal .custom-select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.modal .custom-select-menu::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.3);
}

body.light-theme .modal .custom-select-menu {
  scrollbar-color: rgba(109, 120, 144, 0.34) transparent;
}

body.light-theme .modal .custom-select-menu::-webkit-scrollbar-thumb {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(109, 120, 144, 0.34);
}

body.light-theme .modal-card {
  scrollbar-color: rgba(109, 120, 144, 0.26) transparent;
}

body.light-theme .modal-card::-webkit-scrollbar {
  width: 8px;
  height: 0;
}

body.light-theme .modal-card::-webkit-scrollbar-track {
  background: transparent;
}

body.light-theme .modal-card::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(109, 120, 144, 0.26);
}

.modal .custom-select-option {
  width: 100%;
}
