/* ==========================================================
   Enxora Draw — Professional Client Panel
   Light Theme · Font Awesome · SaaS Grade
   ========================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --brand:        #16a34a;
  --brand-dark:   #15803d;
  --brand-light:  #f0fdf4;
  --brand-mid:    #dcfce7;
  --brand-border: #bbf7d0;

  --white:        #ffffff;
  --gray-25:      #fafafa;
  --gray-50:      #f7f7f8;
  --gray-100:     #f2f2f4;
  --gray-150:     #eaeaed;
  --gray-200:     #e2e2e6;
  --gray-300:     #c8c8cf;
  --gray-400:     #a0a0ab;
  --gray-500:     #717180;
  --gray-600:     #52525f;
  --gray-700:     #3a3a46;
  --gray-800:     #26262f;
  --gray-900:     #18181e;

  --red:          #dc2626;
  --red-light:    #fef2f2;
  --red-border:   #fecaca;
  --amber:        #d97706;
  --amber-light:  #fffbeb;
  --blue:         #2563eb;
  --blue-light:   #eff6ff;

  --sidebar-w:    240px;
  --header-h:     56px;

  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   10px;
  --r-xl:   12px;
  --r-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.09), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.10), 0 8px 16px rgba(0,0,0,0.05);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --t:    0.15s;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::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: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-300); }

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

/* ─────────────────────────────────────────────────────────
   SIDEBAR
   ───────────────────────────────────────────────────────── */
.client-sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-150);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  overflow: hidden;
}

/* Brand */
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--gray-150);
  flex-shrink: 0;
}
.sidebar-brand-logo {
  width: 28px;
  height: 28px;
  background: var(--brand);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}
.sidebar-brand-name em { color: var(--brand); font-style: normal; }

/* Nav top padding when workspace chip removed */
.sidebar-nav { padding-top: 12px; }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gray-400);
  padding: 10px 8px 3px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: background var(--t), color var(--t);
  position: relative;
}
.sidebar-nav a .nav-icon {
  width: 16px;
  color: var(--gray-400);
  font-size: 0.8125rem;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--t);
}
.sidebar-nav a:hover { background: var(--gray-50); color: var(--gray-800); }
.sidebar-nav a:hover .nav-icon { color: var(--gray-600); }
.sidebar-nav a.active {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
}
.sidebar-nav a.active .nav-icon { color: var(--brand); }
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2.5px;
  height: 16px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}

/* ── Upgrade nudge (free plan) ───────────────────────────── */
.sidebar-upgrade-nudge {
  margin: 0 10px 10px;
  padding: 11px 12px;
  background: var(--brand-light);
  border: 1px solid var(--brand-border);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nudge-icon {
  width: 28px;
  height: 28px;
  background: var(--brand);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.nudge-title {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}
.nudge-sub {
  font-size: 0.68rem;
  color: var(--brand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nudge-btn {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  flex-shrink: 0;
  transition: background var(--t);
}
.nudge-btn:hover { background: var(--brand-dark); }

/* ── Sidebar footer user card ─────────────────────────────── */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--gray-150);
  flex-shrink: 0;
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--gray-150);
  background: var(--gray-50);
  transition: background var(--t);
}
.sidebar-user-card:hover { background: var(--gray-100); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.user-info { flex: 1; min-width: 0; }
.user-fullname {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}
.user-meta { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.plan-chip {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-dark);
  background: var(--brand-mid);
  padding: 1px 6px;
  border-radius: 4px;
}
.user-logout-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--gray-400);
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--t);
}
.user-logout-btn:hover {
  border-color: var(--red-border);
  color: var(--red);
  background: var(--red-light);
}

/* ─────────────────────────────────────────────────────────
   MAIN CONTENT
   ───────────────────────────────────────────────────────── */
.app-main { flex: 1; min-width: 0; padding: 28px 32px; }

/* ── Page header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.page-header p {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-top: 3px;
}
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-150);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t);
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.stat-icon-wrap.green  { background: var(--brand-light); color: var(--brand); }
.stat-icon-wrap.blue   { background: var(--blue-light);  color: var(--blue); }
.stat-icon-wrap.amber  { background: var(--amber-light); color: var(--amber); }
.stat-icon-wrap.gray   { background: var(--gray-100);   color: var(--gray-500); }
.stat-val { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); letter-spacing: -0.03em; line-height: 1; }
.stat-lbl { font-size: 0.75rem; color: var(--gray-500); margin-top: 3px; }

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}
.search-wrap .fa {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.75rem;
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  color: var(--gray-800);
  transition: border-color var(--t), box-shadow var(--t);
}
.search-wrap input::placeholder { color: var(--gray-400); }
.search-wrap input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}
.tab-group {
  display: flex;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  overflow: hidden;
}
.tab-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-500);
  background: transparent;
  border: none;
  border-right: 1px solid var(--gray-200);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: var(--gray-50); color: var(--gray-700); }
.tab-btn.active { background: var(--gray-100); color: var(--gray-800); font-weight: 600; }

/* ── Board Grid ──────────────────────────────────────────── */
.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.board-card {
  background: var(--white);
  border: 1px solid var(--gray-150);
  border-radius: var(--r-xl);
  overflow: hidden;
  cursor: pointer;
  display: block;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
  box-shadow: var(--shadow-xs);
  position: relative;
}
.board-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Thumb */
.board-thumb {
  aspect-ratio: 16/10;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-150);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.board-thumb img { width: 100%; height: 100%; object-fit: cover; }
.board-thumb-icon {
  color: var(--gray-300);
  font-size: 1.8rem;
}

/* Hover overlay w/ action buttons */
.board-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--t);
}
.board-card:hover .board-overlay { opacity: 1; }
.overlay-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  box-shadow: var(--shadow-xs);
  transition: all var(--t);
}
.overlay-btn:hover { background: var(--gray-50); border-color: var(--gray-300); }
.overlay-btn.danger { color: var(--red); border-color: var(--red-border); }
.overlay-btn.danger:hover { background: var(--red-light); }

/* Dotmenu */
.board-dotmenu {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  opacity: 0;
  transition: opacity var(--t);
}
.board-card:hover .board-dotmenu { opacity: 1; }
.dotmenu-btn {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--gray-500);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--t);
}
.dotmenu-btn:hover { background: var(--gray-50); color: var(--gray-800); }

/* Collaborators live badge */
.board-live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--green-500, #22c55e);
  background: #22c55e;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-full);
  letter-spacing: 0.04em;
  display: none;
}
.board-card.has-collab .board-live-badge { display: flex; align-items: center; gap: 4px; }
.live-dot {
  width: 5px; height: 5px;
  background: #fff;
  border-radius: var(--r-full);
  animation: blink 1.4s ease infinite;
}
@keyframes blink {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Board meta */
.board-meta { padding: 11px 13px 13px; }
.board-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}
.board-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.board-updated {
  font-size: 0.72rem;
  color: var(--gray-400);
  display: flex;
  align-items: center;
  gap: 4px;
}
/* Collaborator avatars */
.collab-stack { display: flex; align-items: center; }
.collab-pip {
  width: 20px;
  height: 20px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--white);
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-left: -5px;
}
.collab-pip:first-child { margin-left: 0; }

/* Board Shared Section */
.board-shared-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--gray-150);
}
.shared-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.72rem;
  color: var(--gray-500);
}
.shared-label {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sw-copy-btn {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px;
  border-radius: var(--r-sm);
  transition: all var(--t);
  font-size: 0.7rem;
}
.sw-copy-btn:hover {
  color: var(--brand);
  background: var(--brand-light);
}
.sw-collab-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sw-collab-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}
.sw-pip {
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
}
.sw-name {
  color: var(--gray-700);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.sw-active-dot {
  width: 4px;
  height: 4px;
  background: #22c55e;
  border-radius: var(--r-full);
  margin-left: auto;
}
.sw-no-visitors {
  font-size: 0.7rem;
  color: var(--gray-400);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  grid-column: 1/-1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  gap: 10px;
}
.empty-icon-circle {
  width: 56px;
  height: 56px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--gray-400);
  margin-bottom: 6px;
}
.empty-state h3 { font-size: 0.9375rem; font-weight: 600; color: var(--gray-700); }
.empty-state p  { font-size: 0.8125rem; color: var(--gray-400); max-width: 280px; }

/* ── Skeleton loader ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-card { border-radius: var(--r-xl); height: 190px; }

/* ─────────────────────────────────────────────────────────
   PANEL / CARD
   ───────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--gray-150);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
}
.card-icon.green  { background: var(--brand-light); color: var(--brand); }
.card-icon.blue   { background: var(--blue-light);  color: var(--blue); }
.card-icon.amber  { background: var(--amber-light); color: var(--amber); }
.card-icon.red    { background: var(--red-light);   color: var(--red); }
.card-icon.gray   { background: var(--gray-100);    color: var(--gray-500); }

/* ── Info rows ───────────────────────────────────────────── */
.info-rows { display: flex; flex-direction: column; }
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  gap: 12px;
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-label { font-size: 0.8rem; color: var(--gray-500); font-weight: 500; flex-shrink: 0; }
.info-value { font-size: 0.8125rem; font-weight: 600; color: var(--gray-800); text-align: right; }

/* ── Progress ────────────────────────────────────────────── */
.progress-wrap { margin-top: 12px; }
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.progress-bar {
  height: 5px;
  background: var(--gray-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-full);
  transition: width 0.7s var(--ease);
}
.progress-fill.warn   { background: var(--amber); }
.progress-fill.danger { background: var(--red); }

/* ─────────────────────────────────────────────────────────
   BUTTONS
   ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  line-height: 1;
}
.btn i { font-size: 0.75rem; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-dark);
  box-shadow: 0 1px 2px rgba(22,163,74,0.2);
}
.btn-primary:hover {
  background: var(--brand-dark);
  box-shadow: 0 2px 6px rgba(22,163,74,0.3);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-200);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-ghost {
  background: transparent;
  color: var(--gray-500);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }

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

.btn-sm { padding: 5px 11px; font-size: 0.775rem; }
.btn-xs { padding: 3px 9px; font-size: 0.72rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─────────────────────────────────────────────────────────
   BADGE
   ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-green  { background: var(--brand-light);  color: var(--brand-dark);  border: 1px solid var(--brand-border); }
.badge-red    { background: var(--red-light);     color: var(--red);         border: 1px solid var(--red-border); }
.badge-amber  { background: var(--amber-light);   color: var(--amber);       border: 1px solid #fde68a; }
.badge-blue   { background: var(--blue-light);    color: var(--blue);        border: 1px solid #bfdbfe; }
.badge-gray   { background: var(--gray-100);      color: var(--gray-500);    border: 1px solid var(--gray-200); }
.badge-dot { width: 5px; height: 5px; border-radius: var(--r-full); background: currentColor; }

/* ─────────────────────────────────────────────────────────
   FORMS
   ───────────────────────────────────────────────────────── */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-600);
}
.field-input {
  padding: 8px 11px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  color: var(--gray-800);
  transition: border-color var(--t), box-shadow var(--t);
}
.field-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}
.field-input::placeholder { color: var(--gray-300); }
.field-hint  { font-size: 0.75rem; color: var(--gray-400); }
.form-error  { font-size: 0.775rem; color: var(--red); font-weight: 500; padding: 0; }
.form-success{ font-size: 0.775rem; color: var(--brand); font-weight: 500; }

/* ─────────────────────────────────────────────────────────
   MODAL
   ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border: 1px solid var(--gray-150);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.96) translateY(6px);
  transition: transform 0.18s var(--ease);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-head h3 { font-size: 0.9375rem; font-weight: 700; color: var(--gray-900); }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  border: 1px solid var(--gray-200);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--t);
}
.modal-close:hover { background: var(--gray-50); color: var(--gray-800); }
.modal-body { display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ─────────────────────────────────────────────────────────
   CONTEXT MENU
   ───────────────────────────────────────────────────────── */
.ctx-menu {
  position: fixed;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 900;
  min-width: 158px;
  animation: ctx-pop 0.1s var(--ease);
}
@keyframes ctx-pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.ctx-item i { width: 14px; text-align: center; font-size: 0.75rem; color: var(--gray-400); }
.ctx-item:hover { background: var(--gray-50); color: var(--gray-900); }
.ctx-item:hover i { color: var(--gray-600); }
.ctx-item.ctx-danger { color: var(--red); }
.ctx-item.ctx-danger i { color: var(--red); }
.ctx-item.ctx-danger:hover { background: var(--red-light); }
.ctx-sep { height: 1px; background: var(--gray-100); margin: 3px 0; }

/* ─────────────────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────────────────── */
#toast-zone {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
}
.toast-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gray-700);
  min-width: 220px;
  animation: slide-up 0.22s var(--ease);
}
.toast-item i { font-size: 0.8rem; }
.toast-item.t-success { border-left: 3px solid var(--brand); }
.toast-item.t-success i { color: var(--brand); }
.toast-item.t-error   { border-left: 3px solid var(--red); }
.toast-item.t-error   i { color: var(--red); }
.toast-item.t-info    { border-left: 3px solid var(--blue); }
.toast-item.t-info    i { color: var(--blue); }
@keyframes slide-up { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─────────────────────────────────────────────────────────
   PLAN COMPARISON GRID
   ───────────────────────────────────────────────────────── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.plan-tile {
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  padding: 18px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color var(--t), box-shadow var(--t);
}
.plan-tile:hover { border-color: var(--gray-300); box-shadow: var(--shadow-sm); }
.plan-tile.current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-mid);
}
.plan-tile-name { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-400); }
.plan-tile.current .plan-tile-name { color: var(--brand); }
.plan-tile-price { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.04em; line-height: 1; }
.plan-tile-price small { font-size: 0.85rem; font-weight: 500; color: var(--gray-400); }
.plan-tile-features { list-style: none; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.plan-tile-features li {
  font-size: 0.775rem;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-tile-features li i { font-size: 0.65rem; color: var(--brand); width: 10px; }
.plan-tile-features li.off i { color: var(--gray-300); }
.plan-tile-features li.off { color: var(--gray-400); }

/* ─────────────────────────────────────────────────────────
   CODE BLOCK
   ───────────────────────────────────────────────────────── */
.code-wrap { position: relative; }
.code-block {
  background: #f8f9fb;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--gray-700);
  overflow-x: auto;
  line-height: 1.7;
  white-space: pre;
}
.code-block .kw  { color: #7c3aed; font-weight: 600; }
.code-block .str { color: #059669; }
.code-block .cmt { color: var(--gray-400); font-style: italic; }
.code-block .at  { color: #2563eb; }
.code-block .tg  { color: #dc2626; }
.copy-btn {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--t);
}
.copy-btn:hover { color: var(--brand); border-color: var(--brand-border); }

/* ─────────────────────────────────────────────────────────
   DIVIDER
   ───────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--gray-100); margin: 16px 0; }

/* ─────────────────────────────────────────────────────────
   STRENGTH METER
   ───────────────────────────────────────────────────────── */
.strength-bar { height: 4px; background: var(--gray-100); border-radius: var(--r-full); overflow: hidden; margin-top: 6px; }
.strength-fill { height: 100%; border-radius: var(--r-full); transition: width 0.3s, background 0.3s; }

/* ─────────────────────────────────────────────────────────
   AUTH PAGES (login / register)
   ───────────────────────────────────────────────────────── */
.auth-body {
  min-height: 100vh;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 24px;
}
.auth-brand-logo {
  width: 30px; height: 30px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 0.8rem;
}
.auth-brand-name { font-size: 1.05rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.02em; }
.auth-brand-name span { color: var(--brand); }
.auth-card h1 { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; letter-spacing: -0.02em; }
.auth-card .sub-text { font-size: 0.8125rem; color: var(--gray-500); margin-bottom: 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card label { font-size: 0.8rem; font-weight: 600; color: var(--gray-600); display: flex; flex-direction: column; gap: 5px; }
.auth-card input { padding: 8px 11px; border: 1px solid var(--gray-200); border-radius: var(--r-md); font-size: 0.875rem; color: var(--gray-800); background: var(--white); }
.auth-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,163,74,0.12); }
.auth-card input::placeholder { color: var(--gray-300); }

/* ─────────────────────────────────────────────────────────
   UTILITY
   ───────────────────────────────────────────────────────── */
.muted  { color: var(--gray-400) !important; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12{ margin-top: 12px; }
.mt-16{ margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-red { color: var(--red); }
.text-green { color: var(--brand); }
.text-muted { color: var(--gray-500); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.8em;
}

/* ── Mobile & Tablet UI Base Styles ──────────────────────── */
.mobile-top-bar {
  display: none;
}
.sidebar-drawer-backdrop {
  display: none;
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────── */
@media (max-width: 992px) {
  .app-layout {
    flex-direction: column;
  }
  
  /* Show Mobile Header */
  .mobile-top-bar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-150);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .mobile-toggle-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--r-md);
    border: 1px solid var(--gray-200);
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--gray-600);
  }
  .mobile-brand-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-900);
  }
  .mobile-brand-title em {
    color: var(--brand);
    font-style: normal;
  }
  .mobile-logo-box {
    width: 24px;
    height: 24px;
    background: var(--brand);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.65rem;
  }
  .mobile-user-pip {
    width: 28px;
    height: 28px;
    border-radius: var(--r-full);
    background: var(--brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
  }

  /* Sidebar Drawer styling */
  .client-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform var(--t) var(--ease);
    display: flex;
    box-shadow: var(--shadow-lg);
  }
  .client-sidebar.drawer-open {
    transform: translateX(0);
  }

  /* Backdrop Drawer Overlay */
  .sidebar-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t);
  }
  .sidebar-drawer-backdrop.active {
    opacity: 1;
    pointer-events: all;
  }

  .app-main {
    padding: 20px 16px;
  }

  /* Grid Adjustments for smaller viewports */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .board-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  
  /* Double column forms become single column on mobile */
  div[style*="display:grid;grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .header-right {
    width: 100%;
  }
  .header-right .btn {
    flex: 1;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrap {
    max-width: 100%;
  }
  .tab-group {
    width: 100%;
  }
  .tab-btn {
    flex: 1;
    text-align: center;
  }
}
