/* ═══════════════════════════════════════════════════════════════════
   TAOYEN HERITAGE - ENHANCED COMPONENT STYLES
   Advanced components with animations, variants, and polish
════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   BUTTONS - All Variants with States
════════════════════════════════════════════════════════════════════ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:focus-visible {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.btn-md {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
}

.btn-xl {
  padding: var(--space-5) var(--space-8);
  font-size: var(--text-xl);
}

/* Button Icons */
.btn-icon {
  padding: var(--space-3);
  aspect-ratio: 1;
}

.btn-icon-sm {
  padding: var(--space-2);
  width: 2rem;
  height: 2rem;
}

.btn-icon-lg {
  padding: var(--space-4);
  width: 3rem;
  height: 3rem;
}

/* Button Primary — teal (main CTA) */
.btn-primary {
  background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
  color: white;
  border-color: var(--teal-600);
  box-shadow: 0 2px 4px rgba(13, 148, 136, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--teal-600) 0%, var(--teal-700) 100%);
  border-color: var(--teal-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(13, 148, 136, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.15);
}

/* Button Secondary — navy (supporting) */
.btn-secondary {
  background: linear-gradient(135deg, var(--navy-500) 0%, var(--navy-600) 100%);
  color: white;
  border-color: var(--navy-600);
  box-shadow: 0 2px 4px rgba(12, 31, 63, 0.1);
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--navy-600) 0%, var(--navy-700) 100%);
  border-color: var(--navy-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(12, 31, 63, 0.2);
}

/* Button PM - Violet (Distinctive) */
.btn-pm {
  background: linear-gradient(135deg, var(--pm-500) 0%, var(--pm-600) 100%);
  color: white;
  border-color: var(--pm-600);
  box-shadow: 0 2px 4px rgba(109, 40, 217, 0.2);
}

.btn-pm:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--pm-600) 0%, var(--pm-700) 100%);
  border-color: var(--pm-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}

/* Button Outline */
.btn-outline {
  background: transparent;
  color: var(--navy-500);
  border-color: var(--slate-300);
}

.btn-outline:hover:not(:disabled) {
  background: var(--slate-50);
  border-color: var(--navy-300);
  color: var(--navy-600);
}

/* Button Ghost */
.btn-ghost {
  background: transparent;
  color: var(--navy-500);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--slate-100);
}

/* Button Danger */
.btn-danger {
  background: linear-gradient(135deg, var(--error-500) 0%, var(--error-600) 100%);
  color: white;
  border-color: var(--error-600);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--error-600) 0%, var(--error-700) 100%);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

/* Button Success */
.btn-success {
  background: linear-gradient(135deg, var(--success-500) 0%, var(--success-600) 100%);
  color: white;
  border-color: var(--success-600);
}

/* Button Warning */
.btn-warning {
  background: linear-gradient(135deg, var(--warning-500) 0%, var(--warning-600) 100%);
  color: white;
  border-color: var(--warning-600);
}

/* Loading Button State */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 50%;
  left: 50%;
  margin-left: -0.5rem;
  margin-top: -0.5rem;
  border: 2px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════════
   CARDS - Enhanced with Variants and Animations
════════════════════════════════════════════════════════════════════ */

.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--slate-200);
  overflow: hidden;
  transition: all var(--duration-300) var(--ease-out);
  position: relative;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card:focus-within {
  outline: 2px solid var(--teal-500);
  outline-offset: 2px;
}

/* Card Hover Effect - Shine animation */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s ease-in-out;
}

.card:hover::before {
  left: 100%;
}

/* Card Header */
.card-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--slate-200);
  background: linear-gradient(to bottom, var(--slate-50) 0%, var(--white) 100%);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--navy-500);
  margin: 0;
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--slate-500);
  margin-top: var(--space-1);
  margin-bottom: 0;
}

/* Card Body */
.card-body {
  padding: var(--space-6);
}

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

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

/* Card Footer */
.card-footer {
  padding: var(--space-6);
  border-top: 1px solid var(--slate-200);
  background: var(--slate-50);
}

/* Card Variants - Border Left Accents */
.card--pm {
  border-left: 4px solid var(--pm-500);
}

.card--pm .card-header {
  background: linear-gradient(to bottom, var(--pm-50) 0%, var(--white) 100%);
}

.card--success {
  border-left: 4px solid var(--success-500);
}

.card--success .card-header {
  background: linear-gradient(to bottom, var(--success-50) 0%, var(--white) 100%);
}

.card--warning {
  border-left: 4px solid var(--amber-500);
}

.card--warning .card-header {
  background: linear-gradient(to bottom, var(--amber-50) 0%, var(--white) 100%);
}

.card--error {
  border-left: 4px solid var(--error-500);
}

.card--error .card-header {
  background: linear-gradient(to bottom, var(--error-50) 0%, var(--white) 100%);
}

/* Card Elevations */
.card-elevated {
  box-shadow: var(--shadow-lg);
}

.card-elevated:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.card-flat {
  box-shadow: none;
  border: 1px solid var(--slate-300);
}

.card-flat:hover {
  border-color: var(--slate-400);
  transform: none;
}

/* Card with Icon */
.card-with-icon {
  display: flex;
  flex-direction: column;
}

.card-icon-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
}

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   FORMS - Enhanced Inputs with Focus States
════════════════════════════════════════════════════════════════════ */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--slate-700);
}

.form-label-required::after {
  content: " *";
  color: var(--error-500);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: #334155;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  transition: all var(--duration-150) var(--ease-out);
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
  background: white;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: #94a3b8;
}

/* Form Sizes */
.form-input-sm,
.form-select-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.form-input-lg,
.form-select-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
}

/* Form States */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  background: #f1f5f9;
  color: #475569;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Validation States */
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--error-500);
  background: var(--error-50);
}

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  border-color: var(--error-600);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-input.success,
.form-select.success,
.form-textarea.success {
  border-color: var(--success-500);
  background: var(--success-50);
}

.form-input.success:focus,
.form-select.success:focus,
.form-textarea.success:focus {
  border-color: var(--success-600);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* Form Help Text */
.form-hint {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--slate-500);
}

.form-error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--error-500);
}

/* Checkbox & Radio Custom Styles */
.form-checkbox,
.form-radio {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--slate-300);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-150) var(--ease-out);
  position: relative;
}

.form-checkbox:checked,
.form-radio:checked {
  background: var(--teal-500);
  border-color: var(--teal-500);
}

.form-checkbox:checked {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M13.854 2.146a.5.5 0 0 1 .708 0l-7 7a.5.5 0 0 1-.708 0L3.5 9.293a.5.5 0 1 1-.708.708l7-7a.5.5 0 0 1 .708 0l3.5 3.5a.5.5 0 0 1 0 .708-.708L6.5 6.5a.5.5 0 0 1 .708-.708l3.5-3.5a.5.5 0 0 1 0-.708L7 2.146a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
}

.form-radio:checked {
  background-image: radial-gradient(circle, white 40%, transparent 40%);
}

/* Select Dropdown Arrow */
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  padding-right: 2.5rem;
}

/* ═══════════════════════════════════════════════════════════════════
   BADGES - Status Indicators with Icons
════════════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

/* Badge with Icon */
.badge-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
}

/* Badge Variants */
.badge-default {
  background: var(--slate-100);
  color: var(--slate-700);
}

.badge-primary {
  background: var(--navy-100);
  color: var(--navy-700);
}

.badge-secondary {
  background: var(--teal-100);
  color: var(--teal-700);
}

.badge-pm {
  background: var(--pm-100);
  color: var(--pm-700);
}

.badge-success {
  background: var(--success-100);
  color: var(--success-700);
}

.badge-warning {
  background: var(--amber-100);
  color: var(--amber-700);
}

.badge-error {
  background: var(--error-100);
  color: var(--error-700);
}

.badge-info {
  background: var(--info-100);
  color: var(--info-700);
}

/* Status-Specific Badges */
.badge-draft {
  background: var(--slate-100);
  color: var(--slate-700);
}

.badge-pending {
  background: var(--amber-100);
  color: var(--amber-700);
}

.badge-approved {
  background: var(--teal-100);
  color: var(--teal-700);
}

.badge-in-progress {
  background: var(--pm-100);
  color: var(--pm-700);
}

.badge-closed {
  background: var(--success-100);
  color: var(--success-700);
}

.badge-rejected {
  background: var(--error-100);
  color: var(--error-700);
}

/* Animated Badge (for attention) */
.badge-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ═══════════════════════════════════════════════════════════════════
   ALERTS - Notification Banners
════════════════════════════════════════════════════════════════════ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid;
  margin-bottom: var(--space-4);
}

.alert-icon {
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

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

.alert-message {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--slate-600);
}

.alert-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  margin-left: var(--space-2);
  color: var(--slate-400);
  transition: color var(--duration-150) var(--ease-out);
}

.alert-close:hover {
  color: var(--slate-600);
}

/* Alert Variants */
.alert-success {
  background: var(--success-50);
  border-color: var(--success-200);
  color: var(--success-700);
}

.alert-warning {
  background: var(--warning-50);
  border-color: var(--warning-200);
  color: var(--warning-700);
}

.alert-error {
  background: var(--error-50);
  border-color: var(--error-200);
  color: var(--error-700);
}

.alert-info {
  background: var(--info-50);
  border-color: var(--info-200);
  color: var(--info-700);
}

/* Alert Dismissible */
.alert-dismissible {
  padding-right: var(--space-8);
}

/* ═══════════════════════════════════════════════════════════════════
   LOADING SPINNERS
════════════════════════════════════════════════════════════════════ */

.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--slate-200);
  border-top-color: var(--teal-500);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.spinner-lg {
  width: 2rem;
  height: 2rem;
  border-width: 4px;
}

/* Dot Spinner (alternative) */
.spinner-dots {
  display: flex;
  gap: var(--space-2);
}

.spinner-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--teal-500);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

.spinner-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.spinner-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* ═══════════════════════════════════════════════════════════════════
   TABLES - Clean Data Tables
════════════════════════════════════════════════════════════════════ */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--slate-200);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.data-table thead {
  background: var(--slate-50);
  border-bottom: 2px solid var(--slate-200);
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--slate-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--slate-100);
  font-size: var(--text-sm);
  color: var(--slate-600);
}

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

.data-table tbody tr:hover {
  background: var(--slate-50);
}

/* Striped Rows */
.data-table.striped tbody tr:nth-child(even) {
  background: var(--slate-50);
}

/* ═══════════════════════════════════════════════════════════════════
   PROGRESS BARS
════════════════════════════════════════════════════════════════════ */

.progress {
  width: 100%;
  height: 0.5rem;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--teal-500);
  border-radius: var(--radius-full);
  transition: width var(--duration-300) var(--ease-out);
}

.progress-bar-animated {
  background: linear-gradient(
    90deg,
    var(--teal-400) 0%,
    var(--teal-500) 50%,
    var(--teal-600) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Progress Bar Colors */
.progress-bar-secondary {
  background: var(--navy-500);
}

.progress-bar-pm {
  background: var(--pm-500);
}

.progress-bar-success {
  background: var(--success-500);
}

.progress-bar-warning {
  background: var(--warning-500);
}

.progress-bar-error {
  background: var(--error-500);
}

/* ═══════════════════════════════════════════════════════════════════
   TOOLTIPS
════════════════════════════════════════════════════════════════════ */

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: white;
  background: var(--slate-800);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-150) var(--ease-out);
  z-index: var(--z-tooltip);
}

.tooltip:hover::after {
  opacity: 1;
}

/* Tooltip with arrow */
.tooltip[data-tooltip-position="top"]::after {
  bottom: calc(100% + var(--space-2));
}

.tooltip[data-tooltip-position="bottom"]::after {
  top: calc(100% + var(--space-2));
  bottom: auto;
  transform: translateX(-50%) translateY(4px);
}

/* ═══════════════════════════════════════════════════════════════════
   DIVIDER
════════════════════════════════════════════════════════════════════ */

.divider {
  height: 1px;
  background: var(--slate-200);
  border: none;
  margin: var(--space-6) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: var(--slate-200);
  border: none;
  margin: 0 var(--space-6);
}

.divider-with-text {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-6) 0;
}

.divider-with-text::before,
.divider-with-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--slate-200);
}

.divider-with-text span {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--slate-500);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   SKELETON LOADERS
════════════════════════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--slate-200) 0%,
    var(--slate-100) 50%,
    var(--slate-200) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  border-radius: var(--radius-sm);
}

.skeleton-heading {
  height: 1.5rem;
  border-radius: var(--radius-md);
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
}

.skeleton-button {
  width: 8rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
}

/* ═══════════════════════════════════════════════════════════════════
   EMPTY STATES
════════════════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: var(--space-12);
  color: var(--slate-500);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--slate-700);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-base);
  color: var(--slate-500);
  margin-bottom: var(--space-6);
  max-width: 30rem;
  margin-left: auto;
  margin-right: auto;
}

.empty-state-action {
  margin-top: var(--space-4);
}

/* ═══════════════════════════════════════════════════════════════════
   UTILITY ENHANCEMENTS
════════════════════════════════════════════════════════════════════ */

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus trap utilities */
.focus-trap {
  position: relative;
}

.focus-trap::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

/* No transition utility */
.no-transition {
  transition: none !important;
}

/* Truncate text */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Line clamp */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE GRID
════════════════════════════════════════════════════════════════════ */

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.grid-cols-md-2 {
  @media (min-width: 768px) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.grid-cols-lg-3 {
  @media (min-width: 1024px) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Responsive Containers */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }
.container-xl { max-width: var(--container-xl); }

/* Hide on Mobile */
@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Show on Mobile Only */
@media (min-width: 768px) {
  .show-mobile-only {
    display: none !important;
  }
}

/* Hide on Tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Hide on Desktop */
@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   PM FLOW COMPONENTS
   Template cards, service type cards, truck badges
════════════════════════════════════════════════════════════════════ */

/* Template Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 767px) {
  .template-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Template Card */
.template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-5);
  background: var(--slate-50);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-200) var(--ease-out);
  overflow: hidden;
}

.template-card:hover {
  border-color: var(--teal-400);
  background: var(--teal-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.template-card.selected {
  border-color: var(--teal-500);
  background: var(--teal-50);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.template-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-bottom: var(--space-3);
  height: 32px;
}

.template-name {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--slate-900);
  margin-bottom: var(--space-1);
  text-align: center;
}

.template-interval {
  font-size: var(--text-sm);
  color: var(--teal-600);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
}

.template-items {
  font-size: var(--text-xs);
  color: var(--slate-500);
  margin-bottom: var(--space-1);
}

.template-cost {
  font-size: var(--text-sm);
  color: var(--navy-600);
  font-weight: var(--font-semibold);
}

/* PM request — selectable template tiles (not plain text) */
.pm-template-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem 1.125rem;
  width: 100%;
}

@media (max-width: 639px) {
  .pm-template-picker__grid {
    grid-template-columns: 1fr;
  }
}

.pm-pick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  min-height: 220px;
  padding: 0;
  margin: 0;
  background: var(--white, #fff);
  border: 2px solid var(--slate-200, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.pm-pick-card:hover {
  border-color: var(--pm-400, #a78bfa);
  box-shadow: 0 4px 16px rgba(109, 40, 217, 0.12);
  transform: translateY(-2px);
}

.pm-pick-card:focus {
  outline: none;
}

.pm-pick-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.35);
}

.pm-pick-card--selected {
  border-color: var(--pm-600, #7c3aed) !important;
  background: linear-gradient(180deg, var(--pm-50, #faf5ff) 0%, var(--white, #fff) 48%);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18), 0 8px 20px rgba(91, 33, 182, 0.1) !important;
}

.pm-pick-card__accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--pm-500, #6d28d9), var(--pm-400, #a78bfa));
  opacity: 0.85;
}

.pm-pick-card--selected .pm-pick-card__accent {
  width: 5px;
  opacity: 1;
}

.pm-pick-card__header {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 1rem 1rem 0.25rem 1.125rem;
  padding-left: 1.25rem;
}

.pm-pick-card__km {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--pm-700, #6d28d9);
  font-family: var(--font-code, "JetBrains Mono", ui-monospace, monospace);
}

.pm-pick-card__km-suffix {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-500, #64748b);
}

.pm-pick-card__title {
  margin: 0;
  padding: 0.25rem 1rem 0.5rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--slate-800, #1e293b);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pm-pick-card__preview {
  flex: 1 1 auto;
  margin: 0.25rem 0.75rem 0.75rem 1rem;
  padding: 0.5rem 0.65rem;
  background: var(--slate-50, #f8fafc);
  border: 1px solid var(--slate-100, #f1f5f9);
  border-radius: 8px;
  min-height: 4.25rem;
}

.pm-pick-card__list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--slate-600, #475569);
}

.pm-pick-card__list li {
  margin-bottom: 0.15rem;
}

.pm-pick-card__list li:last-child {
  margin-bottom: 0;
}

.pm-pick-card__more {
  margin: 0.35rem 0 0;
  padding: 0;
  font-size: 0.65rem;
  font-style: italic;
  color: var(--slate-500, #64748b);
}

.pm-pick-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding: 0.65rem 1rem 1rem 1.25rem;
  border-top: 1px solid var(--slate-100, #f1f5f9);
  background: rgba(248, 250, 252, 0.6);
}

.pm-pick-card__price {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--navy-700, #1a3460);
}

.pm-pick-card__meta {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--slate-500, #64748b);
  font-family: var(--font-code, "JetBrains Mono", monospace);
}

/* Service Type Grid */
.service-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

@media (max-width: 767px) {
  .service-type-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

/* Service Type Card */
.service-type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-6);
  background: var(--slate-50);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-200) var(--ease-out);
  text-align: center;
}

.service-type-card:hover {
  border-color: var(--pm-400);
  background: var(--pm-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.service-type-card.selected {
  border-color: var(--pm-500);
  background: var(--pm-50);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1);
}

.service-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.service-name {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--slate-900);
  margin-bottom: var(--space-2);
}

.service-desc {
  font-size: var(--text-sm);
  color: var(--slate-600);
  margin-bottom: var(--space-3);
}

.service-meta {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--slate-500);
  font-weight: var(--font-medium);
}

/* Truck Badge */
.truck-badge {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: linear-gradient(135deg, var(--navy-50) 0%, var(--slate-50) 100%);
  border-left: 4px solid var(--navy-500);
  border-radius: var(--radius-md);
}

.truck-badge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--slate-200);
}

.truck-plate {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  font-family: var(--font-mono);
  color: var(--navy-600);
  letter-spacing: 0.05em;
}

.truck-status {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.truck-status.active {
  background: var(--success-100);
  color: var(--success-700);
}

.truck-status.inactive {
  background: var(--error-100);
  color: var(--error-700);
}

.truck-status.maintenance {
  background: var(--warning-100);
  color: var(--warning-700);
}

.truck-badge-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-3);
}

@media (max-width: 767px) {
  .truck-badge-body {
    grid-template-columns: 1fr;
  }
}

.truck-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.truck-info .label {
  font-size: var(--text-xs);
  color: var(--slate-500);
  font-weight: var(--font-medium);
}

.truck-info .value {
  font-size: var(--text-sm);
  color: var(--slate-900);
  font-weight: var(--font-semibold);
}

/* Checklist Section */
.checklist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  color: var(--slate-400);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.empty-text {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checklist-item {
  display: flex;
  align-items: center;
  padding: var(--space-3);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  transition: all var(--duration-150) var(--ease-out);
}

.checklist-item:hover {
  background: var(--slate-100);
  border-color: var(--slate-300);
}

.checklist-item input[type="checkbox"] {
  margin-right: var(--space-3);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checklist-item label {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--slate-700);
  cursor: pointer;
  user-select: none;
}

/* Workflow Container Responsive */
.workflow-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .workflow-container {
    flex-direction: row;
  }
}

.workflow-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

@media (min-width: 1024px) {
  .workflow-body {
    flex-direction: row;
  }
}

.workflow-main {
  flex: 1;
  padding: var(--space-4);
}

@media (min-width: 768px) {
  .workflow-main {
    padding: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .workflow-main {
    padding: var(--space-8);
  }
}

/* Page Header Responsive */
.page-header {
  margin-bottom: var(--space-6);
}

.page-header h1 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--navy-600);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .page-header h1 {
    font-size: var(--text-3xl);
  }
}

/* Form Page Header - Consistent Back Button Placement */
.form-page-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: var(--space-4) 0;
  margin-bottom: var(--space-6);
}

.form-page-header .btn {
  flex-shrink: 0;
}

/* Card Responsive */
.card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
  overflow: hidden;
}

@media (max-width: 767px) {
  .card {
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
  }
}

.card-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
}

@media (max-width: 767px) {
  .card-header {
    padding: var(--space-3);
  }
}

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

@media (max-width: 767px) {
  .card-body {
    padding: var(--space-3);
  }
}

/* Form Responsive */
.fg-item {
  margin-bottom: var(--space-4);
}

@media (max-width: 767px) {
  .fg-item {
    margin-bottom: var(--space-3);
  }
}

.fld-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #334155;
  margin-bottom: var(--space-2);
}

.form-input,
.form-select {
  width: 100%;
  padding: var(--space-3);
  font-size: var(--text-base);
  color: #0f172a;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  transition: all var(--duration-150) var(--ease-out);
}

@media (max-width: 767px) {
  .form-input,
  .form-select {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
  }
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

/* Field Hint */
.field-hint {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: #64748b;
}

/* Action Bar Responsive */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4);
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  margin-top: var(--space-6);
}

@media (max-width: 767px) {
  .action-bar {
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
  }

  .action-bar-left,
  .action-bar-right {
    width: 100%;
  }

  .action-bar .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Sidebar Responsive (if exists) */
@media (max-width: 1023px) {
  .workflow-sidebar {
    display: none;
  }
}
