@font-face {
  font-family: "Mitr Medium";
  src: local("Mitr Medium"), local("Mitr"), url("../Mitr-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

html { scroll-behavior: smooth; }

body { overflow-x: hidden; }

.toast-host {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 10000;
  display: flex;
  justify-content: center;
  padding: 12px;
  padding-top: max(env(safe-area-inset-top), 12px);
}

.toast {
  pointer-events: auto;
  width: min(520px, calc(100vw - 24px));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
  animation: toast-in 160ms ease-out;
}

.toast.is-leaving {
  animation: toast-out 160ms ease-in forwards;
}

.toast-ic {
  font-size: 22px;
  line-height: 1;
  margin-top: 1px;
}

.toast-msg {
  flex: 1;
  font-size: 14px;
  line-height: 1.35;
  color: #0f172a;
}

.toast-x {
  pointer-events: auto;
  border: 0;
  background: transparent;
  color: rgba(15, 23, 42, 0.65);
  padding: 2px;
  border-radius: 10px;
}

.toast-x:hover {
  color: rgba(15, 23, 42, 0.9);
}

.toast-success .toast-ic { color: rgba(16, 185, 129, 1); }
.toast-error .toast-ic { color: rgba(239, 68, 68, 1); }
.toast-warning .toast-ic { color: rgba(245, 158, 11, 1); }
.toast-info .toast-ic { color: rgba(24, 51, 191, 1); }

@keyframes toast-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-10px); opacity: 0; }
}

#header-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
}

#header-bg {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transition: background 0.5s ease, box-shadow 0.5s ease, border-color 0.5s ease;
}

#header-wrap.compact #header-bg {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

#header-row {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2.5rem;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 140px;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#header-wrap.compact #header-row {
  height: 68px;
}

#logo-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

#logo-icon {
  height: 90px;
  width: auto;
  display: block;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, filter 0.4s ease;
}

#logo-text {
  height: 30px;
  margin-top: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Mitr Medium", "Mitr", sans-serif;
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.16em;
  color: #0f172a;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.38s ease, transform 0.38s ease, height 0.35s ease, margin-top 0.35s ease;
}

#header-wrap.compact #logo-icon {
  height: 48px;
  opacity: 0.9;
  filter: contrast(1.12) saturate(0.85) drop-shadow(0 1px 1px rgba(255, 255, 255, 0.5));
}

#header-wrap.compact #logo-text {
  height: 0;
  margin-top: 0;
  opacity: 0;
  transform: translateY(-8px);
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  color: #0f172a;
  transition: color 0.4s ease;
  text-decoration: none;
}

.nav-link.is-active {
  font-weight: 700;
  color: #0b1220;
}

.nav-link:hover {
  color: #1833bf;
}

.mobile-header {
  height: 64px;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 12px;
}

@media (min-width: 1024px) {
  .mobile-header,
  #mobile-nav-overlay,
  #mobile-nav {
    display: none !important;
  }
}

.mobile-header-brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.mobile-header-brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  letter-spacing: 0.14em;
}

.mobile-nav-overlay {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.mobile-nav-panel {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.mobile-nav-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-overlay,
  .mobile-nav-panel {
    transition: none;
  }
}

@media (max-width: 640px) {
  .mobile-tight th,
  .mobile-tight td {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .mobile-sticky-first {
    font-size: 13px;
    line-height: 1.15;
  }

  .mobile-sticky-first th,
  .mobile-sticky-first td {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  .mobile-sticky-first th:first-child,
  .mobile-sticky-first td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: inherit;
    box-shadow: 8px 0 14px rgba(15, 23, 42, 0.08);
  }

  .mobile-sticky-first th:first-child {
    z-index: 20;
  }
}

.panel-modal-sheet {
  max-height: calc(100dvh - 2rem);
  display: flex;
  flex-direction: column;
}

.panel-modal-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-modal-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.panel-modal-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid rgba(226, 232, 240, 1);
  padding-bottom: max(env(safe-area-inset-bottom), 12px);
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.panel-actions > button {
  width: 100%;
}

@media (min-width: 640px) {
  .panel-actions {
    flex-direction: row;
    align-items: center;
  }

  .panel-actions > button {
    width: auto;
  }
}

@media (max-width: 640px) {
  .panel-modal-sheet {
    max-height: calc(100dvh - 0.75rem);
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
  }

  .panel-modal-footer-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-modal-footer-inner .panel-actions {
    width: 100%;
  }
}
