/* ===== MODERN LIGHT THEME ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #10b981;
  --accent-light: #d1fae5;
  --accent-hover: #059669;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #3b82f6;
  --info-light: #dbeafe;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: inherit; }

/* ===== TOP NAVIGATION ===== */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.topnav-brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.topnav-brand .brand-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topnav-add-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== FULL SCREEN MOBILE MENU ===== */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--card);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mobile-menu-close:hover {
  background: var(--border);
}

.mobile-menu-close svg {
  width: 24px;
  height: 24px;
  color: var(--text);
}

.mobile-menu-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.mobile-menu-content .logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 24px;
  margin-bottom: 12px;
}

.mobile-menu-brand {
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.mobile-menu-divider {
  width: 60px;
  height: 2px;
  background: var(--border);
  margin: 32px 0;
  border-radius: 1px;
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 48px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
  font-size: 18px;
  transition: all 0.2s ease;
}

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

.mobile-menu-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.mobile-menu-link svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 0;
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  padding: 24px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.page-header p {
  color: var(--muted);
  margin: 4px 0 0 0;
  font-size: 14px;
}

/* ===== STATS CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow 0.2s ease;
}

.stat-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-card.total .stat-icon {
  background: var(--info-light);
  color: var(--info);
}

.stat-card.active .stat-icon {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-card.inactive .stat-icon {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

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

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--bg);
  border-color: var(--muted);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

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

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* ===== STATUS BOX ===== */
.statusbox {
  margin: 16px 20px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  background: var(--bg);
}

.statusbox.ok {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.statusbox.err {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

/* ===== TABLE ===== */
.tablewrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}

.table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
}

.table tbody tr:hover {
  background: var(--bg);
}

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

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

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

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

/* ===== FORMS ===== */
.form {
  padding: 20px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

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

input,
select,
textarea {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

select {
  cursor: pointer;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.formactions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: toastIn 0.3s ease;
}

.toast.success {
  border-left: 4px solid var(--accent);
}

.toast.error {
  border-left: 4px solid var(--danger);
}

.toast.info {
  border-left: 4px solid var(--info);
}

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

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

/* ===== HAMBURGER MENU ===== */
.hamburger-btn {
  display: none;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.hamburger-btn:hover {
  background: var(--border);
}

.hamburger-btn svg {
  width: 24px;
  height: 24px;
  color: var(--text);
}

/* ===== MOBILE CARD VIEW ===== */
.mobile-cards {
  display: none;
  padding: 0 16px 16px;
  flex-direction: column;
  gap: 12px;
}

.mobile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.mobile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.mobile-card-header .client-name {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.mobile-card-body {
  padding: 16px;
}

.mobile-card-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.mobile-card-row .label {
  color: var(--muted);
  font-weight: 500;
}

.mobile-card-row .value {
  color: var(--text);
  text-align: right;
  word-break: break-all;
  max-width: 60%;
}

.mobile-card-row .value a {
  color: var(--accent);
  text-decoration: none;
}

.mobile-card-row .value a:hover {
  text-decoration: underline;
}

.mobile-card-actions {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.mobile-card-actions .btn {
  flex: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Hamburger visible on mobile */
  .hamburger-btn {
    display: flex;
  }

  /* Hide Add Client button in topnav on mobile */
  .topnav-add-btn {
    display: none;
  }

  /* Full width content on mobile */
  .main-content {
    padding: 16px;
    margin-top: 64px;
  }

  /* Hide table, show cards on mobile */
  .tablewrap {
    display: none;
  }

  .mobile-cards {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .cardhead {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .actions {
    width: 100%;
  }

  .actions .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 12px;
    margin-top: 64px;
  }

  .topnav {
    padding: 0 16px;
  }

  .topnav-brand .brand-text {
    display: none;
  }

  .card {
    border-radius: 8px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 24px;
  }

  .mobile-card {
    border-radius: 8px;
  }

  .mobile-card-header,
  .mobile-card-body,
  .mobile-card-actions {
    padding: 12px;
  }
}
