* {
  font-family: 'Poppins', sans-serif;
  box-sizing: border-box;
}

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

/* ─── Auth pages ─── */

.auth-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.login-background {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background-image: url('/images/login/loginbg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

@media (max-width: 640px) {
  .login-background {
    padding: 1rem 0.75rem;
    background-attachment: scroll;
  }
}

.login-background::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.5) 50%,
    rgba(0, 0, 0, 0.65) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.login-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  margin: auto;
  flex-shrink: 0;
}

.auth-card {
  background: rgba(12, 12, 12, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.2),
    0 25px 50px -12px rgba(0, 0, 0, 0.45);
  padding: 1.5rem;
  overflow: hidden;
}

@media (max-width: 640px) {
  .auth-card {
    padding: 1.25rem 1rem;
    border-radius: 1rem;
  }
}

@media (min-width: 640px) {
  .auth-card {
    padding: 2rem 2.25rem;
  }
}

.auth-card--sm { max-width: min(26rem, 100%); }
.auth-card--md { max-width: min(42rem, 100%); }
.auth-card--lg { max-width: min(56rem, 100%); }

@media (max-width: 640px) {
  .auth-card--sm,
  .auth-card--md,
  .auth-card--lg {
    max-width: 100%;
  }
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .auth-header {
    margin-bottom: 1.125rem;
  }
}

.auth-logo {
  height: 2.75rem;
  width: auto;
  margin: 0.625rem auto;
  display: block;
}

@media (max-width: 640px) {
  .auth-logo {
    height: 2.25rem;
    margin: 0.5rem auto;
  }
}

@media (min-width: 640px) {
  .auth-logo {
    height: 3.25rem;
  }
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 300;
  color: #fff;
  letter-spacing: 0.02em;
  margin: 0;
  line-height: 1.3;
}

@media (max-width: 640px) {
  .auth-title {
    font-size: 1.125rem;
  }
}

@media (min-width: 640px) {
  .auth-title {
    font-size: 1.5rem;
  }
}

.auth-tagline {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  margin-top: 0.375rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (max-width: 640px) {
  .auth-form {
    gap: 0.875rem;
  }
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.auth-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 0.875rem;
  pointer-events: none;
  z-index: 1;
}

.auth-input {
  width: 100%;
  padding: 0.6875rem 0.875rem;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  color: #111827;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  max-width: 100%;
}

@media (max-width: 640px) {
  .auth-input {
    padding: 0.5625rem 0.75rem;
    font-size: 1rem;
  }

  .auth-input--icon {
    padding-left: 2.25rem;
  }
}

.auth-input--icon {
  padding-left: 2.5rem;
}

.auth-input::placeholder {
  color: #9ca3af;
}

.auth-input:focus {
  outline: none;
  border-color: #C1121F;
  box-shadow: 0 0 0 3px rgba(193, 18, 31, 0.18);
}

.auth-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
  cursor: pointer;
}

.auth-textarea {
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.5;
}

.auth-file {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  cursor: pointer;
}

.auth-file::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.375rem 0.875rem;
  border: none;
  border-radius: 0.375rem;
  background: #C1121F;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-file::file-selector-button:hover {
  background: #a8101a;
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.6875rem 1.25rem;
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.auth-btn:active {
  transform: scale(0.98);
}

.auth-btn--primary {
  background: #C1121F;
  color: #fff;
  box-shadow: 0 4px 14px rgba(193, 18, 31, 0.35);
}

.auth-btn--primary:hover {
  background: #a8101a;
}

.auth-btn--primary:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(193, 18, 31, 0.25);
}

.auth-btn--ghost {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.auth-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

.auth-link {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-link:hover {
  color: #fff;
  text-decoration: underline;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  user-select: none;
}

.auth-checkbox input {
  width: 1rem;
  height: 1rem;
  accent-color: #C1121F;
  cursor: pointer;
}

.auth-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

@media (min-width: 640px) {
  .auth-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.auth-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

@media (min-width: 768px) {
  .auth-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.auth-actions-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.625rem;
}

@media (min-width: 480px) {
  .auth-actions-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.auth-register-btns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
}

.auth-register-btns .auth-btn {
  padding: 0.5rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
}

@media (min-width: 400px) {
  .auth-register-btns .auth-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }
}

@media (max-width: 320px) {
  .auth-register-btns {
    grid-template-columns: 1fr;
  }

  .auth-register-btns .auth-btn {
    white-space: normal;
  }
}

.auth-divider {
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8125rem;
  position: relative;
  margin: 0.25rem 0;
  overflow: hidden;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 28%;
  max-width: 6rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-alert {
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: rgba(254, 226, 226, 0.95);
  border: 1px solid #fca5a5;
  color: #991b1b;
  margin-bottom: 1rem;
}

.auth-alert--success {
  background: rgba(220, 252, 231, 0.95);
  border-color: #86efac;
  color: #166534;
}

.auth-alert--dev {
  background: rgba(219, 234, 254, 0.95);
  border-color: #93c5fd;
  color: #1e3a8a;
}

.auth-dev-label {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.auth-dev-link {
  display: block;
  color: #1d4ed8;
  font-size: 0.8125rem;
  word-break: break-all;
  text-decoration: underline;
}

.auth-dev-link:hover {
  color: #1e40af;
}

.auth-footer {
  text-align: center;
  margin-top: 1rem;
}

/* ─── Dashboard utilities ─── */

.h-18 {
  height: 4.5rem;
}

.top-18 {
  top: 4.5rem;
}

.z-60 {
  z-index: 60;
}

.w-90 {
  width: 22.5rem;
}

/* Brand colors fallback (templates use primary / primaryDark) */
.bg-primary {
  background-color: #C1121F;
}

.bg-primaryDark {
  background-color: #780000;
}

.text-primary {
  color: #C1121F;
}

.text-primaryDark {
  color: #780000;
}

.from-primary {
  --tw-gradient-from: #C1121F;
  --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
}

.to-primaryDark {
  --tw-gradient-to: #780000;
}

.hover\:bg-primaryDark:hover {
  background-color: #780000;
}

.hover\:text-primaryDark:hover {
  color: #780000;
}

/* Profile dropdown: visible on hover and click (focus-within) */
.profile-dropdown-menu {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.profile-dropdown:focus-within .profile-dropdown-menu,
.profile-dropdown:hover .profile-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#sidebar-overlay:not(.hidden) {
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 50;
}

/* ─── Client dashboard layout ─── */

:root {
  --client-header-height: 4.5rem;
  --client-aside-width: 20rem;
}

body:has(.client-shell) {
  overflow-x: hidden;
}

.client-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.client-main {
  flex: 1 1 auto;
  width: calc(100% - var(--client-aside-width));
  min-width: 0;
  max-width: 100%;
  min-height: calc(100vh - var(--client-header-height));
  min-height: calc(100dvh - var(--client-header-height));
  margin-left: var(--client-aside-width);
  padding-top: var(--client-header-height);
  overflow-x: hidden;
}

.client-main > section,
.client-main section {
  min-width: 0;
}

body.sidebar-open .client-main {
  margin-left: 0;
  width: 100%;
}

#client-aside {
  position: fixed;
  top: var(--client-header-height);
  bottom: 0;
  left: 0;
  width: var(--client-aside-width);
  height: calc(100vh - var(--client-header-height));
  height: calc(100dvh - var(--client-header-height));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
  transition: opacity 0.3s;
}

.client-aside-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.client-aside-footer {
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

#app-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  will-change: transform;
}

#app-sidebar.sidebar-visible {
  transform: translateX(0);
  pointer-events: auto;
}

#app-sidebar:not(.sidebar-visible) {
  pointer-events: none;
}

body.sidebar-open #client-aside {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Contain intentional horizontal scroll regions (category tabs, carousels) */
.client-hscroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.client-hscroll::-webkit-scrollbar {
  display: none;
}

/* Client header responsive */
#client-header {
  min-width: 0;
  padding-left: 1rem;
  padding-right: 1rem;
}

#client-header .client-header-search {
  min-width: 0;
}

#client-header .client-header-search-btn span {
  display: inline;
}

@media (max-width: 1023px) {
  :root {
    --client-aside-width: 15rem;
  }
}

@media (max-width: 767px) {
  :root {
    --client-aside-width: 0;
  }

  #client-aside {
    display: none;
  }

  .client-main {
    margin-left: 0;
    width: 100%;
  }

  #client-header {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    gap: 0.5rem;
  }

  #client-header .client-header-brand-text {
    display: none;
  }

  #client-header .client-header-search-wrap {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
  }

  #client-header .client-header-search input {
    font-size: 0.8125rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  #client-header .client-header-search-btn {
    padding-left: 0.625rem;
    padding-right: 0.625rem;
  }

  #client-header .client-header-search-btn span {
    display: none;
  }

  #client-header .client-header-actions .client-header-action-btn {
    padding: 0.5rem;
  }

  #client-header .client-header-actions .client-header-divider {
    display: none;
  }
}

/* Client page typography utilities */
.client-page-hero {
  margin-bottom: 2rem;
}

.client-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  color: #111827;
  margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
  .client-page-title {
    font-size: 1.875rem;
  }
}

.client-page-subtitle {
  font-size: 0.875rem;
  color: #4b5563;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

@media (min-width: 768px) {
  .client-page-subtitle {
    font-size: 1rem;
  }
}

.client-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .client-section-title {
    font-size: 1.5rem;
  }
}

/* Aside & sidebar nav typography */
.client-nav-link {
  padding: 0.5rem 0.75rem;
}

.client-nav-link .client-nav-title {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
}

.client-nav-link .client-nav-subtitle {
  font-size: 0.6875rem;
  color: #6b7280;
  line-height: 1.3;
}

.client-nav-link:hover .client-nav-subtitle {
  color: rgba(255, 255, 255, 0.7);
}

.client-nav-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

.client-nav-icon svg {
  width: 1rem;
  height: 1rem;
}
