/* Portawo Design System */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0a;
  --paper: #fafaf8;
  --accent: #ff5c35;
  --accent-hover: #e54d2a;
  --accent-soft: #fff0ec;
  --muted: #6b6b6b;
  --border: #e8e8e4;
  --surface: #f2f2ee;
  --success: #22c55e;
  --success-soft: #dcfce7;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.15; }

/* NAV */
.app-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
}
.app-nav .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.5px;
  color: var(--ink);
  text-decoration: none;
}
.app-nav .logo span { color: var(--accent); }
.app-nav .nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}
.app-nav .nav-links a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.app-nav .nav-links a:hover { color: var(--ink); }
.app-nav .nav-links a.active { color: var(--accent); }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { color: var(--ink); background: var(--surface); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  font-family: 'Space Grotesk', sans-serif;
}
.form-group label .required {
  color: var(--accent);
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  background: white;
  color: var(--ink);
  transition: border-color 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.form-input {
  resize: vertical;
  min-height: 80px;
}
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b6b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* CARDS */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.card-flat { transition: none; }
.card-flat:hover { transform: none; box-shadow: none; }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  font-family: 'Space Grotesk', sans-serif;
}
.badge-pending { background: var(--warning-soft); color: #92400e; }
.badge-active, .badge-in_progress { background: var(--accent-soft); color: var(--accent); }
.badge-completed { background: var(--success-soft); color: #166534; }
.badge-paid { background: var(--success-soft); color: #166534; }
.badge-failed { background: var(--danger-soft); color: #991b1b; }
.badge-expired { background: var(--surface); color: var(--muted); }
.badge-ready { background: #dbeafe; color: #1e40af; }

/* PROGRESS BAR */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 100px;
  transition: width 0.4s ease;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: white;
  border-radius: 20px;
  padding: 32px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-overlay.active .modal {
  transform: scale(1);
}
.modal h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ALERT */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: var(--danger-soft); color: #991b1b; }
.alert-success { background: var(--success-soft); color: #166534; }
.alert-info { background: var(--accent-soft); color: var(--accent); }

/* LAYOUT */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}
.auth-container {
  max-width: 420px;
  margin: 80px auto;
  padding: 0 24px;
}
.auth-container h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
.auth-container .subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 32px;
}
.auth-container .auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}
.auth-container .auth-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--muted);
}
.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.empty-state h3 {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 15px;
  margin-bottom: 24px;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  max-width: 400px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.toast-success { background: #166534; }
.toast.toast-error { background: #991b1b; }

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

/* RESPONSIVE */
@media (max-width: 768px) {
  .app-nav { padding: 12px 16px; }
  .container { padding: 16px; }
  .auth-container { margin: 40px auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .modal { width: 95%; padding: 24px; }
}

/* UTILITIES */
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 13px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }
