/* === Card (Glassmorphism) === */
.card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.card-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

/* === KPI Grid === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-red {
  background: #fee2e2;
  color: #dc2626;
}

.badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

.badge-blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-gray {
  background: #f1f5f9;
  color: #475569;
}

/* === Data Table === */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 12px;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  color: #334155;
}

.data-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.data-table .link {
  color: #2563eb;
  cursor: pointer;
  font-weight: 500;
}

.data-table .link:hover {
  text-decoration: underline;
}

/* === Buttons === */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  line-height: 1.4;
}

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

.btn-primary {
  background: #0f172a;
  color: white;
}

.btn-primary:hover {
  background: #1e293b;
}

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-ghost {
  background: transparent;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.btn-ghost:hover {
  background: #f8fafc;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 28px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #0f172a;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* === Forms === */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
  color: #0f172a;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 2000;
  animation: toast-in 0.3s ease;
  max-width: 380px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.toast.toast-error {
  background: #dc2626;
}

.toast.toast-success {
  background: #16a34a;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* === Tabs === */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  user-select: none;
}

.tab:hover {
  color: #334155;
}

.tab.active {
  color: #0f172a;
  border-bottom-color: #3b82f6;
}

/* === Timeline === */
.timeline {
  list-style: none;
  padding: 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.timeline-dot.green { background: #22c55e; }
.timeline-dot.red { background: #ef4444; }
.timeline-dot.yellow { background: #f59e0b; }
.timeline-dot.blue { background: #3b82f6; }
.timeline-dot.gray { background: #94a3b8; }

.timeline-content {
  flex: 1;
}

.timeline-title {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
}

.timeline-meta {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* === Client Header === */
.client-header {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px;
  margin-bottom: 20px;
}

.client-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #475569;
  flex-shrink: 0;
}

.client-info {
  flex: 1;
}

.client-name {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.client-referent {
  font-size: 13px;
  color: #64748b;
}

.client-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.client-actions {
  display: flex;
  gap: 8px;
}

/* === Status Dot === */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.green { background: #22c55e; }
.status-dot.red { background: #ef4444; }
.status-dot.yellow { background: #f59e0b; }
.status-dot.gray { background: #94a3b8; }

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 48px;
  color: #94a3b8;
  font-size: 14px;
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* === Filter Bar === */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: white;
  color: #475569;
  transition: all 0.15s;
  user-select: none;
  font-family: inherit;
}

.filter-chip:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.filter-chip.active {
  background: #0f172a;
  color: white;
  border-color: #0f172a;
}

/* === Grid Layouts === */
.columns-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.columns-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* === Section Title === */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
}

/* === Machine Card === */
.machine-card {
  padding: 16px;
}

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

.machine-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

.machine-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

.machine-detail dt {
  font-weight: 600;
}

.machine-detail dd {
  text-align: right;
}

/* === Info Rows === */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

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

.info-label {
  color: #64748b;
  font-weight: 500;
}

.info-value {
  color: #0f172a;
  font-weight: 600;
}

/* === Quick Actions === */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* === Loading === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #94a3b8;
  font-size: 14px;
}

.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Deadline Card === */
.deadline-card {
  padding: 16px;
  margin-bottom: 12px;
}

.deadline-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
}

.deadline-card-name:hover {
  color: #2563eb;
}

.deadline-card-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.deadline-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* === Case Card === */
.case-card {
  padding: 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.case-card:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.case-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.case-card-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

/* === Scrollbar in sidebar === */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* === Key display === */
.license-key {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: 6px;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

/* === Payment table status === */
.payment-paid {
  color: #15803d;
  font-weight: 600;
}

.payment-unpaid {
  color: #dc2626;
  font-weight: 600;
}

/* Search dropdown items */
.search-item { padding: 10px 16px; cursor: pointer; display: flex; align-items: center; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f8fafc; }

