/* ==========================================================================
   HOTEL WOOD STONE — GLOBAL COMPONENT SYSTEM
   Phase 9A.4 | Reusable UI Components
   All styles use --hws-* CSS custom properties from main.css
   ==========================================================================

   TABLE OF CONTENTS
   ─────────────────
   01. SIDEBAR COMPONENT
       - Container & structure
       - Brand area
       - Navigation sections & items
       - Collapsed state
       - Mobile overlay drawer
   02. TOP NAVBAR COMPONENT
       - Glass header bar
       - Left zone (hamburger + breadcrumb)
       - Center zone (search)
       - Right zone (notifications + profile)
       - Profile dropdown
   03. CARD COMPONENT
       - Base card
       - Variants: elevated, gold, glass
       - Card anatomy: header, body, footer
       - KPI / metric card
   04. MODAL COMPONENT
       - Backdrop overlay
       - Modal container & sizes
       - Modal anatomy: header, body, footer
       - Close button
       - Entrance / exit animations
   05. ALERT COMPONENT
       - Base alert
       - Semantic variants: success, warning, danger, info
       - Inline alert
       - Toast notification & toast stack
   06. TABLE COMPONENT
       - Scroll wrapper
       - Table base
       - Header, body, row styles
       - Sortable columns
       - Pagination controls
       - Empty & loading states
   07. LOADER COMPONENT
       - Skeleton shimmer: text, circle, rect, card, row
       - Spinner variants: sm, md, lg
       - Full-page loader overlay
   ========================================================================== */


/* ============================================================
   01. SIDEBAR COMPONENT
   ============================================================ */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  background: linear-gradient(
    180deg,
    #0D0505 0%,
    var(--hws-espresso) 25%,
    #130807 60%,
    #0A0202 100%
  );
  border-right: 1px solid var(--border-subtle);
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.55);
  transition: width var(--duration-slow) var(--ease-out-soft);
  overflow: hidden;
}

/* Scrollable nav area */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: var(--hws-ash) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 3px;
}
.sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: var(--hws-ash);
  border-radius: 2px;
}

/* ---- Brand area ---- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--hws-burgundy) 0%, var(--hws-wine) 100%);
  border: 1px solid var(--hws-gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo svg {
  width: 22px;
  height: 22px;
}

.sidebar-brand-text {
  overflow: hidden;
  transition: opacity var(--duration-normal) var(--ease-out-soft),
              width var(--duration-slow) var(--ease-out-soft);
}

.sidebar-brand-name {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--hws-ivory);
  white-space: nowrap;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.sidebar-brand-sub {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--hws-stone);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  white-space: nowrap;
  margin-top: 1px;
}

/* ---- Navigation sections ---- */
.nav-section {
  padding: var(--space-4) 0 var(--space-2);
}

.nav-section + .nav-section {
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-1);
}

.nav-label {
  display: flex;
  align-items: center;
  padding: 0 var(--space-5) var(--space-2);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hws-stone);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--duration-normal) var(--ease-out-soft);
}

.nav-label-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  margin-left: var(--space-2);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out-soft);
}

/* ---- Navigation items ---- */
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  margin: 1px var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--hws-beige);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  border-left: 2px solid transparent;
  transition:
    color var(--duration-fast) ease,
    background var(--duration-fast) ease,
    border-color var(--duration-fast) ease;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  transition: background var(--duration-fast) ease;
}

.nav-item:hover {
  color: var(--hws-ivory);
  border-left-color: rgba(211, 161, 115, 0.35);
}

.nav-item:hover::before {
  background: linear-gradient(
    90deg,
    rgba(211, 161, 115, 0.07) 0%,
    transparent 100%
  );
}

.nav-item.active {
  color: var(--hws-gold);
  border-left-color: var(--hws-gold);
  font-weight: var(--weight-medium);
}

.nav-item.active::before {
  background: linear-gradient(
    90deg,
    rgba(211, 161, 115, 0.13) 0%,
    transparent 100%
  );
}

/* Nav icon */
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: color var(--duration-fast) ease;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

/* Nav text label */
.nav-text {
  flex: 1;
  position: relative;
  z-index: 1;
  transition: opacity var(--duration-normal) var(--ease-out-soft);
}

/* Nav badge */
.nav-badge {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--hws-burgundy);
  border: 1px solid rgba(211, 161, 115, 0.20);
  color: var(--hws-ivory);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: opacity var(--duration-normal) var(--ease-out-soft);
}

.nav-badge:empty {
  display: none;
}

/* ---- Sidebar footer ---- */
.sidebar-footer {
  flex-shrink: 0;
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  overflow: hidden;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast) ease;
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hws-burgundy) 0%, var(--hws-smoky) 100%);
  border: 1px solid var(--hws-gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--hws-gold);
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
  transition: opacity var(--duration-normal) var(--ease-out-soft);
}

.sidebar-user-name {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--hws-ivory);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--hws-stone);
  white-space: nowrap;
  text-transform: capitalize;
  margin-top: 1px;
}

/* ---- Sidebar toggle button ---- */
.sidebar-toggle-btn {
  position: absolute;
  top: calc(var(--header-height) / 2 - 14px);
  right: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--hws-espresso);
  border: 1px solid var(--border-soft);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hws-stone);
  z-index: 10;
  transition: color var(--duration-fast) ease,
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
}

.sidebar-toggle-btn:hover {
  color: var(--hws-gold);
  background: var(--hws-smoky);
  border-color: var(--hws-gold-border);
}

.sidebar-toggle-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform var(--duration-slow) var(--ease-out-soft);
}

/* ---- Collapsed state ---- */
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-label-line {
  opacity: 1;
}

.sidebar.collapsed .nav-item {
  padding: 10px;
  margin: 1px var(--space-2);
  justify-content: center;
  border-left-color: transparent;
}

.sidebar.collapsed .nav-item.active {
  border-left-color: transparent;
  background: rgba(211, 161, 115, 0.10);
  border-radius: var(--radius-md);
}

.sidebar.collapsed .nav-icon {
  margin: 0;
}

.sidebar.collapsed .sidebar-footer {
  padding: var(--space-4) var(--space-3);
}

.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: var(--space-2);
}

.sidebar.collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

/* ---- Tooltip on collapsed hover ---- */
.nav-item[data-tooltip] {
  position: relative;
}

.sidebar.collapsed .nav-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--hws-smoky);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 5px var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--hws-ivory);
  white-space: nowrap;
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) ease;
  z-index: 100;
}

.sidebar.collapsed .nav-item[data-tooltip]:hover::after {
  opacity: 1;
}

/* ---- Mobile overlay drawer ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 1, 1, 0.65);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  transition: opacity var(--duration-slow) ease;
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--duration-slow) var(--ease-out-soft);
    width: var(--sidebar-width) !important;
    box-shadow: none;
  }

  .sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.65);
  }

  .sidebar-overlay {
    display: block;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle-btn {
    display: none;
  }
}


/* ============================================================
   02. TOP NAVBAR COMPONENT
   ============================================================ */

.app-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  z-index: var(--z-header);
  background: rgba(10, 2, 2, 0.82);
  backdrop-filter: blur(18px) saturate(1.6) brightness(1.04);
  -webkit-backdrop-filter: blur(18px) saturate(1.6) brightness(1.04);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 0 rgba(211, 161, 115, 0.06),
              0 4px 16px rgba(0, 0, 0, 0.25);
  transition: left var(--duration-slow) var(--ease-out-soft);
}

/* Adjust when sidebar is collapsed */
.sidebar.collapsed ~ .main-layout .app-header,
body.sidebar-collapsed .app-header {
  left: var(--sidebar-collapsed);
}

/* ---- Left zone ---- */
.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Hamburger (mobile) */
.header-hamburger {
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--hws-beige);
  border: 1px solid transparent;
  background: transparent;
  transition: color var(--duration-fast) ease,
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
}

.header-hamburger:hover {
  color: var(--hws-gold);
  background: rgba(211, 161, 115, 0.08);
  border-color: var(--border-subtle);
}

.header-hamburger svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

/* Breadcrumb */
.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb-item {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-stone);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.breadcrumb-item:hover {
  color: var(--hws-beige);
}

.breadcrumb-item.current {
  color: var(--hws-ivory);
  font-weight: var(--weight-medium);
}

.breadcrumb-separator {
  color: var(--hws-ash);
  font-size: 10px;
  line-height: 1;
}

/* Page title (alternative to breadcrumb) */
.header-page-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--hws-ivory);
  letter-spacing: 0.01em;
}

/* ---- Center zone ---- */
.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}

.header-search {
  position: relative;
  width: 100%;
}

.header-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--hws-stone);
  pointer-events: none;
}

.header-search-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.header-search-input {
  width: 100%;
  height: 36px;
  padding: 0 var(--space-4) 0 calc(var(--space-3) + 15px + var(--space-2));
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-ivory);
  transition: border-color var(--duration-fast) ease,
              background var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
  outline: none;
}

.header-search-input::placeholder {
  color: var(--hws-ash);
}

.header-search-input:focus {
  border-color: rgba(211, 161, 115, 0.40);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(211, 161, 115, 0.08);
}

/* ---- Right zone ---- */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  margin-left: auto;
}

/* Vertical divider */
.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 var(--space-1);
}

/* Icon button (notifications, etc.) */
.header-icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--hws-beige);
  border: 1px solid transparent;
  background: transparent;
  transition: color var(--duration-fast) ease,
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
}

.header-icon-btn:hover {
  color: var(--hws-gold);
  background: rgba(211, 161, 115, 0.08);
  border-color: var(--border-subtle);
}

.header-icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

/* Notification dot */
.header-icon-btn .notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hws-burgundy);
  border: 1.5px solid var(--hws-black);
}

/* Notification badge count */
.header-icon-btn .notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: var(--hws-burgundy);
  border: 1.5px solid var(--hws-black);
  color: var(--hws-ivory);
  font-size: 9px;
  font-weight: var(--weight-bold);
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ---- Profile button ---- */
.header-profile {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
  position: relative;
}

.header-profile:hover {
  background: rgba(211, 161, 115, 0.06);
  border-color: var(--border-subtle);
}

.header-profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hws-burgundy) 0%, var(--hws-smoky) 100%);
  border: 1px solid var(--hws-gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  color: var(--hws-gold);
  flex-shrink: 0;
}

.header-profile-info {
  display: none;
}

.header-profile-name {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--hws-ivory);
  white-space: nowrap;
}

.header-profile-role {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--hws-stone);
  white-space: nowrap;
  text-transform: capitalize;
}

.header-profile-chevron {
  color: var(--hws-stone);
  transition: transform var(--duration-fast) ease;
}

.header-profile-chevron svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Profile dropdown */
.profile-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: 200px;
  background: var(--hws-smoky);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  transition: opacity var(--duration-fast) ease,
              transform var(--duration-fast) ease;
  z-index: var(--z-dropdown);
}

.header-profile.open .profile-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.header-profile.open .header-profile-chevron {
  transform: rotate(180deg);
}

.dropdown-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.dropdown-user-name {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--hws-ivory);
}

.dropdown-user-role {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--hws-stone);
  margin-top: 1px;
  text-transform: capitalize;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-beige);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--duration-fast) ease,
              color var(--duration-fast) ease;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--hws-ivory);
}

.dropdown-item svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  color: var(--hws-stone);
}

.dropdown-item:hover svg {
  color: var(--hws-gold);
}

.dropdown-item.danger {
  color: #d4756f;
}

.dropdown-item.danger:hover {
  background: rgba(212, 117, 111, 0.08);
}

.dropdown-item.danger svg {
  color: #d4756f;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-1) 0;
}

/* ---- Responsive header ---- */
@media (max-width: 1199px) {
  .app-header {
    left: var(--sidebar-collapsed);
  }
}

@media (max-width: 991px) {
  .app-header {
    left: 0;
    padding: 0 var(--space-4);
  }

  .header-hamburger {
    display: flex;
  }

  .header-center {
    display: none;
  }
}

@media (min-width: 1280px) {
  .header-profile-info {
    display: block;
  }
}


/* ============================================================
   03. CARD COMPONENT
   ============================================================ */

.card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) ease,
              border-color var(--duration-normal) ease,
              transform var(--duration-normal) ease;
}

/* Gold hairline top-edge accent */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--hws-gold-border) 30%,
    rgba(211, 161, 115, 0.40) 50%,
    var(--hws-gold-border) 70%,
    transparent 100%
  );
  pointer-events: none;
}

/* ---- Card variants ---- */

/* Elevated — stronger shadow, slight lift on hover */
.card--elevated {
  box-shadow: var(--shadow-card);
}

.card--elevated:hover {
  box-shadow: var(--shadow-dialog);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

/* Gold accent — left border in gold */
.card--gold {
  border-left: 2px solid var(--hws-gold);
}

.card--gold::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(211, 161, 115, 0.06) 0%,
    transparent 100%
  );
  pointer-events: none;
}

/* Glass variant */
.card--glass {
  background: rgba(27, 13, 10, 0.65);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-color: rgba(211, 161, 115, 0.18);
}

/* Dark surface variant */
.card--dark {
  background: var(--surface-0);
  border-color: var(--border-subtle);
}

/* Warm gradient card */
.card--warm {
  background: linear-gradient(
    145deg,
    var(--hws-wine) 0%,
    var(--hws-espresso) 60%,
    var(--hws-black) 100%
  );
}

/* Flat — no border or shadow */
.card--flat {
  border-color: transparent;
  box-shadow: none;
}

.card--flat::before {
  display: none;
}

/* Interactive card */
.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-card);
}

/* ---- Card anatomy ---- */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--hws-ivory);
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.card-subtitle {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--hws-stone);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.card-body {
  padding: var(--space-5);
}

.card-body + .card-body {
  padding-top: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.10);
}

.card-footer--left {
  justify-content: flex-start;
}

.card-footer--between {
  justify-content: space-between;
}

/* Card with no header padding-top in body */
.card-header + .card-body {
  padding-top: var(--space-5);
}

/* ---- KPI / metric card ---- */
.kpi-card {
  position: relative;
  background: linear-gradient(
    145deg,
    var(--hws-wine) 0%,
    var(--hws-espresso) 60%,
    var(--hws-black) 100%
  );
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  overflow: hidden;
  transition: border-color var(--duration-normal) ease,
              transform var(--duration-normal) ease;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--hws-gold-border) 30%,
    rgba(211, 161, 115, 0.45) 50%,
    var(--hws-gold-border) 70%,
    transparent 100%
  );
}

/* Ambient gold glow in corner */
.kpi-card::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(211, 161, 115, 0.10) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.kpi-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.kpi-label {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--hws-stone);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.kpi-label svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  color: var(--hws-gold-muted);
}

.kpi-value {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
  color: var(--hws-ivory);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: var(--space-3);
}

.kpi-value--sm {
  font-size: var(--text-2xl);
}

.kpi-value--lg {
  font-size: 2.5rem;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
}

.kpi-delta--up {
  color: #7ab98a;
  background: rgba(122, 185, 138, 0.12);
}

.kpi-delta--down {
  color: #c97b7b;
  background: rgba(201, 123, 123, 0.12);
}

.kpi-delta--neutral {
  color: var(--hws-stone);
  background: rgba(140, 123, 116, 0.12);
}

.kpi-delta svg {
  width: 10px;
  height: 10px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

.kpi-subtext {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--hws-stone);
  margin-top: var(--space-2);
}


/* ============================================================
   04. MODAL COMPONENT
   ============================================================ */

/* ---- Backdrop overlay ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 1, 1, 0.78);
  backdrop-filter: blur(5px) saturate(0.75);
  -webkit-backdrop-filter: blur(5px) saturate(0.75);
  z-index: var(--z-modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Modal container ---- */
.modal {
  position: relative;
  background: linear-gradient(
    160deg,
    var(--hws-wine) 0%,
    var(--hws-espresso) 40%,
    var(--hws-black) 100%
  );
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-dialog);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--space-8));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--duration-slow) var(--ease-out-soft),
              opacity var(--duration-slow) var(--ease-out-soft);
}

/* Gold hairline top edge */
.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--hws-gold-border) 25%,
    rgba(211, 161, 115, 0.50) 50%,
    var(--hws-gold-border) 75%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

/* ---- Modal sizes ---- */
.modal--sm {
  max-width: 360px;
}

.modal--lg {
  max-width: 720px;
}

.modal--xl {
  max-width: 960px;
}

.modal--full {
  max-width: calc(100vw - var(--space-8));
  max-height: calc(100vh - var(--space-8));
}

/* ---- Modal anatomy ---- */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-6) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-title-group {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--hws-ivory);
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.modal-subtitle {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-stone);
  margin-top: var(--space-1);
}

.modal-close {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--hws-stone);
  background: transparent;
  border: 1px solid transparent;
  transition: color var(--duration-fast) ease,
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
  margin-top: -2px;
}

.modal-close:hover {
  color: var(--hws-ivory);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-subtle);
}

.modal-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: var(--hws-ash) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 4px;
}

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

.modal-body::-webkit-scrollbar-thumb {
  background: var(--hws-ash);
  border-radius: 2px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.modal-footer--between {
  justify-content: space-between;
}

/* ---- Confirm modal variant ---- */
.modal--confirm .modal-body {
  text-align: center;
  padding: var(--space-8) var(--space-6) var(--space-6);
}

.modal-confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto var(--space-5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-confirm-icon--danger {
  background: rgba(201, 123, 123, 0.15);
  border: 1px solid rgba(201, 123, 123, 0.25);
  color: #c97b7b;
}

.modal-confirm-icon--warning {
  background: rgba(211, 161, 115, 0.15);
  border: 1px solid rgba(211, 161, 115, 0.25);
  color: var(--hws-gold);
}

.modal-confirm-icon--success {
  background: rgba(122, 185, 138, 0.15);
  border: 1px solid rgba(122, 185, 138, 0.25);
  color: #7ab98a;
}

.modal-confirm-icon svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.modal-confirm-message {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-beige);
  line-height: var(--leading-relaxed);
  max-width: 320px;
  margin: 0 auto;
}

/* ---- Mobile bottom-sheet modal ---- */
@media (max-width: 767px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .modal::before {
    left: 30%;
    right: 30%;
  }

  .modal-overlay.open .modal {
    transform: translateY(0);
  }
}


/* ============================================================
   05. ALERT COMPONENT
   ============================================================ */

/* ---- Base alert ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  position: relative;
}

.alert-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.alert-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.alert-text {
  opacity: 0.85;
}

.alert-dismiss {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.55;
  background: transparent;
  border: none;
  color: inherit;
  transition: opacity var(--duration-fast) ease,
              background var(--duration-fast) ease;
  margin-top: -2px;
  margin-right: -4px;
}

.alert-dismiss:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.alert-dismiss svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ---- Alert variants ---- */
.alert--info {
  background: rgba(100, 130, 170, 0.10);
  border-color: rgba(100, 130, 170, 0.25);
  color: #9bb5d0;
}

.alert--success {
  background: rgba(122, 185, 138, 0.10);
  border-color: rgba(122, 185, 138, 0.25);
  color: #8ed0a0;
}

.alert--warning {
  background: rgba(211, 161, 115, 0.10);
  border-color: rgba(211, 161, 115, 0.28);
  color: var(--hws-gold);
}

.alert--danger {
  background: rgba(201, 123, 123, 0.10);
  border-color: rgba(201, 123, 123, 0.25);
  color: #d0908a;
}

/* Soft (lighter bg) variants */
.alert--info.alert--soft    { background: rgba(100, 130, 170, 0.06); }
.alert--success.alert--soft { background: rgba(122, 185, 138, 0.06); }
.alert--warning.alert--soft { background: rgba(211, 161, 115, 0.06); }
.alert--danger.alert--soft  { background: rgba(201, 123, 123, 0.06); }

/* Left accent border */
.alert--accent {
  border-left-width: 3px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ---- Toast notification ---- */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-dialog);
  min-width: 280px;
  max-width: 400px;
  animation: toastIn var(--duration-slow) var(--ease-out-soft) forwards;
  cursor: default;
}

.toast.toast--leaving {
  animation: toastOut var(--duration-normal) ease forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.toast-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.toast-message {
  flex: 1;
  font-weight: var(--weight-medium);
}

.toast-dismiss {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  border-radius: var(--radius-sm);
  color: inherit;
  border: none;
  background: transparent;
  transition: opacity var(--duration-fast) ease;
}

.toast-dismiss:hover { opacity: 1; }

.toast-dismiss svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Toast colour variants — same as alert */
.toast--info    { background: rgba(17, 10, 9, 0.95); border-color: rgba(100,130,170,0.35); color: #9bb5d0; }
.toast--success { background: rgba(17, 10, 9, 0.95); border-color: rgba(122,185,138,0.35); color: #8ed0a0; }
.toast--warning { background: rgba(17, 10, 9, 0.95); border-color: rgba(211,161,115,0.40); color: var(--hws-gold); }
.toast--danger  { background: rgba(17, 10, 9, 0.95); border-color: rgba(201,123,123,0.35); color: #d0908a; }

/* Toast stack container */
.toast-stack {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast-stack .toast {
  pointer-events: auto;
}

@media (max-width: 480px) {
  .toast-stack {
    left: var(--space-4);
    right: var(--space-4);
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }
}

/* ---- Toast keyframes ---- */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
    max-height: 80px;
    margin-bottom: 0;
  }
  to {
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
    max-height: 0;
    margin-bottom: calc(-1 * var(--space-3));
    padding-top: 0;
    padding-bottom: 0;
  }
}


/* ============================================================
   06. TABLE COMPONENT
   ============================================================ */

/* ---- Scroll wrapper ---- */
.data-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  scrollbar-width: thin;
  scrollbar-color: var(--hws-ash) transparent;
}

.data-table-wrapper::-webkit-scrollbar {
  height: 4px;
}

.data-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.data-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--hws-ash);
  border-radius: 2px;
}

/* ---- Table base ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

/* Gold hairline top accent on wrapper */
.data-table-wrapper::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--hws-gold-border) 25%,
    rgba(211, 161, 115, 0.35) 50%,
    var(--hws-gold-border) 75%,
    transparent 100%
  );
}

/* ---- Table toolbar (search + actions above table) ---- */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.table-toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.table-search {
  position: relative;
  width: 240px;
}

.table-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--hws-stone);
  pointer-events: none;
}

.table-search-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.table-search-input {
  width: 100%;
  height: 34px;
  padding: 0 var(--space-3) 0 calc(var(--space-3) + 14px + var(--space-2));
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--hws-ivory);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease;
}

.table-search-input::placeholder {
  color: var(--hws-ash);
}

.table-search-input:focus {
  border-color: rgba(211, 161, 115, 0.40);
  box-shadow: 0 0 0 3px rgba(211, 161, 115, 0.08);
}

/* ---- Table header ---- */
.data-table thead {
  border-bottom: 1px solid var(--border-soft);
}

.data-table thead th {
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--hws-stone);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.12);
  position: relative;
}

.data-table thead th:first-child {
  border-radius: 0;
}

/* Sortable column */
.data-table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color var(--duration-fast) ease;
}

.data-table thead th.sortable:hover {
  color: var(--hws-beige);
}

.data-table thead th.sort-asc,
.data-table thead th.sort-desc {
  color: var(--hws-gold);
}

.sort-indicator {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin-left: var(--space-1);
  vertical-align: middle;
  opacity: 0.4;
}

.sort-indicator-up,
.sort-indicator-down {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.sort-indicator-up {
  border-bottom: 5px solid currentColor;
}

.sort-indicator-down {
  border-top: 5px solid currentColor;
}

th.sort-asc .sort-indicator { opacity: 1; }
th.sort-asc .sort-indicator-down { opacity: 0.25; }
th.sort-desc .sort-indicator { opacity: 1; }
th.sort-desc .sort-indicator-up { opacity: 0.25; }

/* ---- Table body ---- */
.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) ease;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(211, 161, 115, 0.04);
}

.data-table tbody tr.selected {
  background: rgba(211, 161, 115, 0.07);
}

.data-table tbody td {
  padding: var(--space-4) var(--space-5);
  color: var(--hws-beige);
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody td.wrap {
  white-space: normal;
}

/* Column alignments */
.col-center { text-align: center; }
.col-right   { text-align: right;  }
.col-mono    { font-family: monospace; font-size: 12px; }

/* Checkbox column */
.data-table .col-check {
  width: 40px;
  padding-left: var(--space-4);
  padding-right: var(--space-2);
}

/* ---- Table status chip ---- */
.table-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: capitalize;
  white-space: nowrap;
}

.table-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.table-status--green   { color: #7ab98a; background: rgba(122,185,138,0.10); }
.table-status--yellow  { color: #c9b37b; background: rgba(201,179,123,0.10); }
.table-status--red     { color: #c97b7b; background: rgba(201,123,123,0.10); }
.table-status--blue    { color: #7b9bc9; background: rgba(123,155,201,0.10); }
.table-status--stone   { color: var(--hws-stone); background: rgba(140,123,116,0.10); }

/* ---- Row action buttons ---- */
.table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  justify-content: flex-end;
}

.table-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--hws-stone);
  background: transparent;
  border: 1px solid transparent;
  transition: color var(--duration-fast) ease,
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
}

.table-action-btn:hover {
  color: var(--hws-gold);
  background: rgba(211, 161, 115, 0.08);
  border-color: var(--border-subtle);
}

.table-action-btn.danger:hover {
  color: #c97b7b;
  background: rgba(201, 123, 123, 0.08);
  border-color: rgba(201, 123, 123, 0.20);
}

.table-action-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

/* ---- Empty state ---- */
.table-empty {
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.table-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  color: var(--hws-ash);
}

.table-empty-icon svg {
  width: 48px;
  height: 48px;
  stroke: currentColor;
  stroke-width: 1.2;
  fill: none;
}

.table-empty-title {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  color: var(--hws-stone);
  margin-bottom: var(--space-2);
}

.table-empty-text {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-ash);
  max-width: 280px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

/* ---- Pagination ---- */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.table-pagination-info {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--hws-stone);
}

.table-pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--hws-beige);
  background: transparent;
  border: 1px solid transparent;
  transition: color var(--duration-fast) ease,
              background var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
}

.page-btn:hover {
  color: var(--hws-ivory);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
}

.page-btn.active {
  color: var(--hws-gold);
  background: rgba(211, 161, 115, 0.10);
  border-color: var(--hws-gold-border);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.page-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Per-page select */
.table-per-page {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--hws-stone);
}

.table-per-page select {
  height: 28px;
  padding: 0 var(--space-2);
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--hws-beige);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  cursor: pointer;
  outline: none;
}

.table-per-page select:focus {
  border-color: var(--hws-gold-border);
}


/* ============================================================
   07. LOADER COMPONENT
   ============================================================ */

/* ---- Skeleton shimmer base ---- */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(211, 161, 115, 0.08) 30%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(211, 161, 115, 0.08) 70%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 600px 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* Shape variants */
.skeleton--text {
  height: 14px;
  border-radius: 4px;
  margin-bottom: var(--space-2);
}

.skeleton--text:last-child {
  width: 65%;
}

.skeleton--text--lg {
  height: 20px;
  margin-bottom: var(--space-3);
}

.skeleton--text--sm {
  height: 10px;
}

.skeleton--circle {
  border-radius: 50%;
}

.skeleton--rect {
  border-radius: var(--radius-md);
}

/* Pre-sized skeletons */
.skeleton--h-4  { height: 16px; }
.skeleton--h-6  { height: 24px; }
.skeleton--h-8  { height: 32px; }
.skeleton--h-10 { height: 40px; }
.skeleton--h-12 { height: 48px; }
.skeleton--h-16 { height: 64px; }
.skeleton--h-32 { height: 128px; }
.skeleton--h-48 { height: 192px; }

.skeleton--w-1\/4  { width: 25%; }
.skeleton--w-1\/2  { width: 50%; }
.skeleton--w-3\/4  { width: 75%; }
.skeleton--w-full  { width: 100%; }

/* ---- Skeleton card ---- */
.skeleton-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.skeleton-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.skeleton-card-body > .skeleton--text {
  margin-bottom: var(--space-3);
}

/* ---- Skeleton KPI card ---- */
.skeleton-kpi {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* ---- Skeleton table row ---- */
.skeleton-table-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.skeleton-table-row:last-child {
  border-bottom: none;
}

/* ---- Spinner ---- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(211, 161, 115, 0.15);
  border-top-color: var(--hws-gold);
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

/* Spinner sizes */
.spinner--xs  { width: 14px; height: 14px; border-width: 1.5px; }
.spinner--sm  { width: 18px; height: 18px; border-width: 2px; }
.spinner--lg  { width: 36px; height: 36px; border-width: 3px; }
.spinner--xl  { width: 48px; height: 48px; border-width: 3px; }

/* Colour variants */
.spinner--ivory {
  border-color: rgba(243, 234, 226, 0.15);
  border-top-color: var(--hws-ivory);
}

.spinner--stone {
  border-color: rgba(140, 123, 116, 0.15);
  border-top-color: var(--hws-stone);
}

/* Inline spinner (inside buttons / text) */
.spinner-inline {
  display: inline-block;
  vertical-align: middle;
}

/* ---- Ring pulse ---- */
@keyframes ringPulse {
  0%   { transform: scale(0.85); opacity: 0.8; }
  50%  { transform: scale(1.05); opacity: 1;   }
  100% { transform: scale(0.85); opacity: 0.8; }
}

.spinner--pulse {
  animation: ringPulse 1.4s ease-in-out infinite;
  border: 2px solid rgba(211, 161, 115, 0.35);
  background: transparent;
}

/* ---- Spinner + label row ---- */
.spinner-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.spinner-label {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-stone);
}

/* ---- Full-page loader overlay ---- */
.page-loader {
  position: fixed;
  inset: 0;
  background: rgba(10, 2, 2, 0.88);
  backdrop-filter: blur(8px) saturate(0.7);
  -webkit-backdrop-filter: blur(8px) saturate(0.7);
  z-index: var(--z-loader);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) ease;
}

.page-loader.active {
  opacity: 1;
  pointer-events: auto;
}

.page-loader-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--hws-burgundy) 0%, var(--hws-wine) 100%);
  border: 1px solid var(--hws-gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.page-loader-logo svg {
  width: 30px;
  height: 30px;
}

.page-loader-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(211, 161, 115, 0.12);
  border-top-color: var(--hws-gold);
  animation: spin 0.85s linear infinite;
}

.page-loader-text {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--hws-stone);
  letter-spacing: 0.06em;
}

/* ---- Section / card loader (inline) ---- */
.section-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  flex-direction: column;
  gap: var(--space-4);
}

/* ---- Dot pulse loader ---- */
@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1; }
}

.dot-loader {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot-loader span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hws-gold);
  animation: dotPulse 1.2s ease-in-out infinite;
}

.dot-loader span:nth-child(2) { animation-delay: 0.16s; }
.dot-loader span:nth-child(3) { animation-delay: 0.32s; }

.dot-loader--sm span {
  width: 5px;
  height: 5px;
}

/* ---- Progress bar ---- */
@keyframes progressIndeterminate {
  0%   { left: -40%; width: 40%; }
  60%  { left: 100%; width: 40%; }
  100% { left: 100%; width: 0%; }
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(211, 161, 115, 0.12);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--hws-gold) 0%, var(--hws-bronze) 100%);
  border-radius: 2px;
  transition: width var(--duration-slow) ease;
}

.progress-bar--indeterminate .progress-bar-fill {
  position: absolute;
  animation: progressIndeterminate 1.6s ease-in-out infinite;
}


/* ============================================================
   UTILITY: Reduced motion overrides
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .spinner,
  .spinner--pulse,
  .page-loader-spinner,
  .dot-loader span,
  .progress-bar--indeterminate .progress-bar-fill {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .modal,
  .sidebar,
  .sidebar-brand-text,
  .nav-text,
  .nav-badge,
  .nav-label,
  .sidebar-user-info,
  .toast,
  .profile-dropdown,
  .card--elevated {
    transition-duration: 0.01ms !important;
  }
}
