/* Waybill & Dispatch Hub — smooth UI tokens */

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

html {
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  min-height: 100dvh;
}

/* Buttery 250ms transitions on interactive elements */
button,
a,
input,
select,
textarea,
.nav-link,
.btn,
.card-interactive,
.data-row {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 250ms;
}

/* Glassmorphic nav */
.nav-glass {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgb(241 245 249); /* slate-100 */
}

/* Cards */
.card {
  background: #ffffff;
  border: 1px solid rgb(241 245 249);
  border-radius: 1rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.04), 0 1px 2px -1px rgb(0 0 0 / 0.04);
}

.card-interactive:hover,
.data-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
}

/* Primary button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border-radius: 0.75rem;
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

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

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 2px rgb(37 99 235 / 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: 0 4px 12px rgb(37 99 235 / 0.35);
}

.btn-secondary {
  background: #fff;
  color: #334155;
  border-color: rgb(226 232 240);
}

.btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
  border-color: rgb(203 213 225);
}

.btn-success {
  background: #059669;
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #047857;
}

.btn-danger {
  background: #e11d48;
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: #475569;
}

.btn-ghost:hover:not(:disabled) {
  background: #f1f5f9;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 0.5rem;
}

.btn-block {
  width: 100%;
}

/* Form controls */
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgb(226 232 240);
  background: #fff;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  color: #0f172a;
  outline: none;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.02);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: rgb(203 213 225);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #94a3b8;
}

.form-error {
  font-size: 0.75rem;
  color: #e11d48;
  margin-top: 0.25rem;
}

.form-hint {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* Metric tiles */
.metric-tile {
  background: #fff;
  border: 1px solid rgb(241 245 249);
  border-radius: 1rem;
  padding: 1rem 1.125rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.04);
}

.metric-tile .metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #0f172a;
  line-height: 1.2;
}

.metric-tile .metric-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 1rem;
  border: 1px solid rgb(241 245 249);
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid rgb(241 245 249);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgb(248 250 252);
  vertical-align: middle;
}

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

.data-table tbody tr.data-row {
  cursor: default;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #94a3b8;
}

/* Safe area for mobile bottom nav */
.pb-safe {
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

/* Print — A6 waybill */
@media print {
  body * {
    visibility: hidden;
  }
  #waybill-print,
  #waybill-print * {
    visibility: visible;
  }
  #waybill-print {
    position: absolute;
    left: 0;
    top: 0;
    width: 105mm;
    min-height: 148mm;
  }
  .no-print {
    display: none !important;
  }
}

@page {
  size: A6;
  margin: 4mm;
}

/* Skeleton pulse */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 0.5rem;
}

/* Scrollbar subtle */
.table-wrap::-webkit-scrollbar {
  height: 6px;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

/* Focus visible for a11y */
:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Mobile bottom sheet feel for forms */
@media (max-width: 640px) {
  .mobile-sheet {
    border-radius: 1.25rem 1.25rem 0 0;
  }
}
