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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #F5F8FB;
  color: #1E293B;
  line-height: 1.5;
}

/* ── LAYOUT ───────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: #0F1B2D;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .25s ease, min-width .25s ease;
  flex-shrink: 0;
}
.sidebar.collapsed { width: 68px; min-width: 68px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  gap: 8px;
}
.sidebar-logo .logo-full { height: 32px; object-fit: contain; flex: 1; min-width: 0; }
.sidebar-logo .logo-icon {
  width: 32px; height: 32px; background: #DA0466; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.collapse-btn {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.08); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.6); flex-shrink: 0; transition: background .15s;
}
.collapse-btn:hover { background: rgba(255,255,255,.14); color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin-bottom: 4px; }
.section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.35);
  padding: 8px 8px 4px; white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; height: 40px; border-radius: 10px;
  color: rgba(255,255,255,.75); text-decoration: none; gap: 10px;
  padding: 0 12px; transition: all .15s; white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: #DA0466; color: #fff; }
.nav-item svg { flex-shrink: 0; }
.nav-label { font-size: 13px; font-weight: 500; }
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .section-label { text-align: center; overflow: hidden; font-size: 8px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0 14px; }

/* User footer */
.sidebar-user {
  margin: 8px; padding: 10px; border-radius: 12px;
  background: rgba(255,255,255,.05); cursor: pointer; flex-shrink: 0;
  transition: background .15s; position: relative;
}
.sidebar-user:hover { background: rgba(255,255,255,.08); }
.sidebar-user > div:first-child { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #DA0466, #EB7507);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 12px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: 11px; color: #94A3B8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar.collapsed .user-info { display: none; }

.user-menu {
  position: absolute; bottom: calc(100% + 4px); left: 8px; right: 8px;
  background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
  overflow: hidden; z-index: 100;
}
.user-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  font-size: 13px; color: #374151; text-decoration: none; transition: background .1s;
}
.user-menu-item:hover { background: #F9FAFB; }
.user-menu-item.danger { color: #DC2626; }
.user-menu-item.danger:hover { background: #FEF2F2; }

/* ── MAIN AREA ────────────────────────────────── */
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-content { flex: 1; padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ── MOBILE ───────────────────────────────────── */
.mobile-topbar {
  display: none; align-items: center; gap: 12px;
  padding: 12px 16px; background: #0F1B2D;
  position: sticky; top: 0; z-index: 50;
}
.mobile-menu-btn { background: none; border: none; color: #fff; cursor: pointer; display: flex; }
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
}
@media (max-width: 768px) {
  .mobile-topbar { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    z-index: 100; transform: translateX(-100%);
    transition: transform .25s ease; width: 240px !important; min-width: 240px !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-overlay.active { display: block; }
  .page-content { padding: 16px; }
}

/* ── CARDS ────────────────────────────────────── */
.card {
  background: #fff; border-radius: 12px; border: 1px solid #E2E8F0;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-header { padding: 16px 20px; border-bottom: 1px solid #F1F5F9; }
.card-body { padding: 20px; }
.card-title { font-size: 15px; font-weight: 600; color: #0F1B2D; }

/* ── METRIC CARDS ─────────────────────────────── */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card {
  background: #fff; border-radius: 12px; padding: 20px;
  border: 1px solid #E2E8F0; display: flex; flex-direction: column; gap: 8px;
}
.metric-label { font-size: 12px; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 28px; font-weight: 700; color: #0F1B2D; line-height: 1; }
.metric-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }

/* ── BUTTONS ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; text-decoration: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: #DA0466; color: #fff; }
.btn-primary:hover { background: #b8035a; }
.btn-secondary { background: #F1F5F9; color: #374151; }
.btn-secondary:hover { background: #E2E8F0; }
.btn-outline { background: transparent; color: #374151; border: 1px solid #E2E8F0; }
.btn-outline:hover { background: #F8FAFC; }
.btn-danger { background: #DC2626; color: #fff; }
.btn-danger:hover { background: #B91C1C; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: 8px; background: #F1F5F9; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #64748B; transition: all .15s; }
.btn-icon:hover { background: #E2E8F0; color: #374151; }

/* ── FORMS ────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1px solid #E2E8F0; border-radius: 8px;
  font-size: 13px; color: #1E293B; outline: none; transition: border .15s;
  background: #fff; font-family: inherit;
}
.form-control:focus { border-color: #DA0466; box-shadow: 0 0 0 3px rgba(218,4,102,.08); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── BADGES ───────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid transparent;
}
.badge-blue   { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.badge-green  { background: #F0FDF4; color: #15803D; border-color: #BBF7D0; }
.badge-red    { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
.badge-yellow { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.badge-purple { background: #FDF4FF; color: #7E22CE; border-color: #E9D5FF; }
.badge-gray   { background: #F8FAFC; color: #475569; border-color: #E2E8F0; }
.badge-pink   { background: #FFF1F2; color: #BE123C; border-color: #FECDD3; }

/* ── TABLE ────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: 12px; border: 1px solid #E2E8F0; }
table { width: 100%; border-collapse: collapse; background: #fff; }
thead th {
  background: #F8FAFC; padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 700; color: #64748B; text-transform: uppercase;
  letter-spacing: .04em; border-bottom: 1px solid #E2E8F0;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid #F1F5F9; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #F8FAFC; }

/* ── MODAL ────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 640px;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: slideUp .2s ease;
}
.modal-lg { max-width: 900px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid #F1F5F9;
}
.modal-title { font-size: 16px; font-weight: 700; color: #0F1B2D; }
.modal-close { background: none; border: none; cursor: pointer; color: #94A3B8; padding: 4px; border-radius: 6px; display: flex; }
.modal-close:hover { color: #374151; background: #F1F5F9; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #F1F5F9; display: flex; justify-content: flex-end; gap: 8px; }

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

/* ── PAGE HEADER ──────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 20px; font-weight: 700; color: #0F1B2D; }
.page-subtitle { font-size: 13px; color: #64748B; margin-top: 2px; }

/* ── KANBAN ───────────────────────────────────── */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; }
.kanban-column {
  min-width: 260px; max-width: 280px; background: #F8FAFC;
  border-radius: 12px; border: 1px solid #E2E8F0; display: flex; flex-direction: column;
}
.kanban-col-header {
  padding: 12px 14px; border-radius: 12px 12px 0 0; display: flex;
  align-items: center; justify-content: space-between;
}
.kanban-col-title { font-size: 12px; font-weight: 700; }
.kanban-col-count { font-size: 11px; font-weight: 700; opacity: .7; }
.kanban-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
  background: #fff; border-radius: 10px; padding: 14px;
  border: 1px solid #E2E8F0; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: box-shadow .15s, transform .1s;
}
.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-1px); }
.kanban-card-title { font-size: 13px; font-weight: 600; color: #0F1B2D; margin-bottom: 6px; }
.kanban-card-meta { font-size: 11px; color: #64748B; display: flex; flex-wrap: wrap; gap: 6px; }

/* ── FILTERS ──────────────────────────────────── */
.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #94A3B8; pointer-events: none; }
.search-input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid #E2E8F0; border-radius: 8px; font-size: 13px; outline: none; }
.search-input:focus { border-color: #DA0466; }

/* ── UTILS ────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: #64748B; }
.font-semibold { font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── LOADING ──────────────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; }
.spinner { width: 28px; height: 28px; border: 3px solid #E2E8F0; border-top-color: #DA0466; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ────────────────────────────────────── */
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: #fff; border-radius: 10px; border: 1px solid #E2E8F0;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); font-size: 13px; font-weight: 500;
  min-width: 280px; animation: slideInRight .2s ease;
}
.toast.success { border-left: 3px solid #10B981; }
.toast.error   { border-left: 3px solid #EF4444; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── EMPTY STATE ──────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: #94A3B8; }
.empty-state svg { margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }
