/* ============================================
Partnify — Design System
   Mobile First
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── Variables ─────────────────────────────── */
:root {
  /* Colors */
  --primary:       #0A0F1E;
  --accent:        #5B5FEF;
  --accent-light:  #EEF0FF;
  --accent-hover:  #4548D4;
  --success:       #00C48C;
  --success-light: #E6FAF5;
  --warning:       #FFB020;
  --warning-light: #FFF8E6;
  --danger:        #F03E3E;
  --danger-light:  #FFF0F0;

  /* Neutrals */
  --bg:            #F5F5F7;
  --surface:       #FFFFFF;
  --border:        #E8E8ED;
  --text:          #0A0F1E;
  --text-muted:    #8A8A9A;
  --text-light:    #B8B8C8;

  /* Typography */
  --font-display:  'Syne', sans-serif;
  --font-body:     'DM Sans', sans-serif;

  /* Spacing */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
  --s6: 48px;
  --s8: 64px;

  /* Radius */
  --r-sm:   8px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   28px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(10,15,30,0.06);
  --shadow-md: 0 4px 20px rgba(10,15,30,0.08);
  --shadow-lg: 0 12px 40px rgba(10,15,30,0.12);

  /* Layout */
  --sidebar-w: 240px;
  --navbar-h:  64px;
  --bottomnav-h: 64px;
  --content-max: 1200px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: 15px;
}

/* ── Typography ────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary);
}

h1 { font-size: clamp(28px, 6vw, 56px); }
h2 { font-size: clamp(22px, 4vw, 36px); }
h3 { font-size: clamp(18px, 3vw, 24px); }
h4 { font-size: 18px; }
h5 { font-size: 16px; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }

/* ── Logo ──────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: var(--s1);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--primary);
  text-decoration: none;
}

.logo-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: var(--r-full);
  flex-shrink: 0;
}

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  padding: 10px 20px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91,95,239,0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(91,95,239,0.4);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--r-md);
}

.btn-full { width: 100%; }

.btn-icon {
  padding: 8px;
  border-radius: var(--r-sm);
}

/* ── Cards ─────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--s3);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card-hover {
  transition: all var(--transition);
}

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

/* ── Stat Cards ────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--s3);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s1);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-value.success { color: var(--success); }
.stat-value.accent  { color: var(--accent); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Badges ────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: var(--success-light);
  color: #00906A;
}

.badge-warning {
  background: var(--warning-light);
  color: #CC8800;
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-accent {
  background: var(--accent-light);
  color: var(--accent);
}

.badge-neutral {
  background: var(--bg);
  color: var(--text-muted);
}

/* ── Forms ─────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--s2);
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,95,239,0.12);
}

.form-control::placeholder {
  color: var(--text-light);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
}

/* ── Navbar ────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--s3);
  z-index: 100;
  gap: var(--s2);
}

.navbar-brand { flex: 1; }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.navbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  display: none; /* nascosta su mobile */
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--s3) var(--s2);
  overflow-y: auto;
  z-index: 90;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
}

.sidebar-link:hover {
  background: var(--bg);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  padding: var(--s2) 12px var(--s1);
}

/* ── Bottom Nav (mobile) ───────────────────── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 9px;
  font-weight: 500;
  transition: color var(--transition);
  min-width: 0;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.bottom-nav-item.active {
  color: var(--accent);
}

/* ── Main Layout ───────────────────────────── */
.app-layout {
  padding-top: var(--navbar-h);
  padding-bottom: var(--bottomnav-h);
  min-height: 100vh;
}

.main-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s3) var(--s2);
}

.page-header {
  margin-bottom: var(--s4);
}

.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Grid ──────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--s2);
}

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

/* ── Alerts / Banners ──────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-md);
  font-size: 14px;
}

.alert-success {
  background: var(--success-light);
  color: #00906A;
  border: 1px solid #B3EDD9;
}

.alert-warning {
  background: var(--warning-light);
  color: #CC8800;
  border: 1px solid #FFE099;
}

.alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #FFCCCC;
}

.alert-info {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #D0D4FC;
}

/* ── Tables ────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--bg);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--bg); }

/* ── Modal ─────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,15,30,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  padding: var(--s3);
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s4);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s3);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

/* ── Copy Button ───────────────────────────── */
.copy-field {
  display: flex;
  align-items: center;
  gap: var(--s1);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
}

.copy-field-text {
  flex: 1;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.copy-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.copy-btn.copied {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

/* ── Empty State ───────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s8) var(--s3);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--bg);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s3);
  font-size: 28px;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 300px;
  margin-bottom: var(--s3);
}

/* ── Loading ───────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

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

/* ── Divider ───────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--s3) 0;
}

/* ── Utils ─────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1  { gap: var(--s1); }
.gap-2  { gap: var(--s2); }
.gap-3  { gap: var(--s3); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.mt-1 { margin-top: var(--s1); }
.mt-2 { margin-top: var(--s2); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mb-1 { margin-bottom: var(--s1); }
.mb-2 { margin-bottom: var(--s2); }
.mb-3 { margin-bottom: var(--s3); }
.mb-4 { margin-bottom: var(--s4); }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Desktop ───────────────────────────────── */
@media (min-width: 768px) {
  .main-content {
    padding: var(--s4) var(--s4);
  }

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

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    flex-direction: column;
  }

  .bottom-nav {
    display: none;
  }

  .app-layout {
    padding-left: var(--sidebar-w);
    padding-bottom: 0;
  }

  .main-content {
    padding: var(--s6) var(--s6);
  }
}

/* ── Public pages layout ───────────────────── */
.public-layout {
  padding-top: var(--navbar-h);
}

.public-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--s3);
}

/* ── Toasts ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottomnav-h) + var(--s2));
  right: var(--s2);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  z-index: 999;
}

.toast {
  background: var(--primary);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 320px;
}

.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger); }
.toast.warning { background: var(--warning); color: var(--primary); }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@media (min-width: 1024px) {
  .toast-container {
    bottom: var(--s3);
  }
}