:root {
  --bg-main: #f5f6f9;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbfc;
  --border-color: #e2e8f0;
  --border-focus: #3483fa;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --ml-yellow: #fff159;
  --ml-yellow-hover: #ebd838;
  --ml-yellow-dark: #ccb800;
  --ml-blue: #3483fa;
  --ml-blue-hover: #2968c8;
  --ml-navy: #2d3277;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-main: 0 4px 16px -2px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.03);
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* Header Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--ml-yellow);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ml-navy);
  font-size: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.brand-info h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2d3277;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-info p {
  font-size: 0.82rem;
  color: #4b5563;
}

.badge-tag {
  background: #2d3277;
  color: #ffffff;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--ml-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--ml-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(52, 131, 250, 0.25);
}

.btn-yellow {
  background-color: var(--ml-yellow);
  color: #2d3277;
  border: 1px solid #ebd838;
}

.btn-yellow:hover {
  background-color: var(--ml-yellow-hover);
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 5px;
}

.btn-danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #ef4444;
}

/* Layout Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 22px;
}

@media (max-width: 960px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title i {
  color: var(--ml-blue);
  margin-right: 6px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--ml-blue);
  background: #f0f7ff;
}

.dropzone-icon {
  font-size: 38px;
  color: var(--ml-blue);
  margin-bottom: 10px;
  transition: var(--transition);
}

.dropzone-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.dropzone-hint {
  font-size: 0.78rem;
  color: #64748b;
}

.file-preview {
  display: none;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 12px;
  align-items: center;
  justify-content: space-between;
}

.file-preview.active {
  display: flex;
}

.file-preview-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.file-preview-icon {
  font-size: 22px;
  color: var(--ml-blue);
}

.file-preview-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.file-preview-size {
  font-size: 0.75rem;
  color: #64748b;
}

/* Form Controls */
.form-group {
  margin-top: 16px;
}

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: #1e293b;
  font-size: 0.88rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--ml-blue);
  box-shadow: 0 0 0 3px rgba(52, 131, 250, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Progress bar */
.progress-container {
  display: none;
  margin-top: 16px;
}

.progress-container.active {
  display: block;
}

.progress-track {
  background: #e2e8f0;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  background: var(--ml-blue);
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* Result Card */
.delivery-result-card {
  display: none;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--ml-yellow-dark);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 22px;
}

.delivery-result-card.active {
  display: block;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e293b;
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.result-header i {
  color: var(--success);
  font-size: 1.1rem;
}

.link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.link-input {
  background: transparent;
  border: none;
  color: var(--ml-blue);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  width: 100%;
  outline: none;
}

/* ML Message Template Section */
.ml-template-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 12px;
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.template-header span {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
}

.template-content {
  background: #f8fafc;
  border-radius: 6px;
  padding: 12px;
  font-size: 0.85rem;
  color: #334155;
  white-space: pre-wrap;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  line-height: 1.5;
  max-height: 220px;
  overflow-y: auto;
}

/* Delivery History List */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.search-box {
  width: 220px;
}

.deliveries-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 680px;
  overflow-y: auto;
  padding-right: 2px;
}

.deliveries-list::-webkit-scrollbar {
  width: 5px;
}

.deliveries-list::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.deliveries-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.delivery-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.delivery-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.delivery-item.expired {
  background: #fafafa;
  border-color: #e5e7eb;
}

.delivery-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.file-info-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-icon-badge {
  width: 38px;
  height: 38px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: var(--ml-blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.file-meta-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1e293b;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta-sub {
  font-size: 0.75rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.status-active {
  background: var(--success-bg);
  color: #047857;
  border: 1px solid #a7f3d0;
}

.status-expired {
  background: var(--danger-bg);
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.status-limit {
  background: var(--warning-bg);
  color: #b45309;
  border: 1px solid #fde68a;
}

.countdown-pill {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #e2e8f0;
}

.countdown-pill.urgent {
  color: #dc2626;
  background: #fef2f2;
  border-color: #fecaca;
}

.delivery-buyer-info {
  background: #f8fafc;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 10px 0;
  font-size: 0.78rem;
  color: #475569;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid #f1f5f9;
}

.delivery-buyer-info strong {
  color: #1e293b;
}

.delivery-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: #94a3b8;
}

.empty-state i {
  font-size: 40px;
  color: #cbd5e1;
  margin-bottom: 10px;
}

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-md);
  max-width: 500px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
}

.modal-close:hover {
  color: #1e293b;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success {
  background: #065f46;
}

.toast.error {
  background: #991b1b;
}
