/* ==========================================================================
   Contractor Gate — Admin panel design system
   Plain CSS, no build step. Matches the product brand (#0128CE, Poppins).
   ========================================================================== */

:root {
  --cg-brand: #0128CE;
  --cg-brand-dark: #011FA3;
  --cg-brand-tint: #EEF1FF;
  --cg-ink: #101828;
  --cg-body: #475467;
  --cg-muted: #667085;
  --cg-line: #E4E7EC;
  --cg-bg: #F7F8FC;
  --cg-surface: #FFFFFF;

  --cg-success: #039855;
  --cg-success-tint: #ECFDF3;
  --cg-warn: #B54708;
  --cg-warn-tint: #FFFAEB;
  --cg-danger: #D92D20;
  --cg-danger-tint: #FEF3F2;

  --cg-radius: 12px;
  --cg-radius-sm: 8px;
  --cg-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --cg-shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

body.cg {
  margin: 0;
  background: var(--cg-bg);
  color: var(--cg-ink);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ------------------------------------------------------- */
.cg-shell { display: flex; min-height: 100vh; }

.cg-sidebar {
  width: 248px;
  flex: 0 0 248px;
  /* On-brand depth gradient (matches the login screen). */
  background: linear-gradient(180deg, var(--cg-brand) 0%, #010F5C 100%);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 16px rgba(1, 15, 92, .12);
}
.cg-sidebar__brand {
  font-size: 17px; font-weight: 600; letter-spacing: -.2px;
  padding: 4px 12px 24px; display: flex; align-items: center; gap: 10px;
}
.cg-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.cg-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 10px;
  color: rgba(255, 255, 255, .78); text-decoration: none;
  font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.cg-nav a i { width: 18px; text-align: center; }
.cg-nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; transform: translateX(4px); }
.cg-nav a.is-active { background: #fff; color: var(--cg-brand); font-weight: 600; box-shadow: 0 4px 12px rgba(1, 15, 92, .18); }
.cg-sidebar__foot { padding-top: 16px; border-top: 1px solid rgba(255,255,255,.18); }

.cg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cg-topbar {
  background: var(--cg-surface); border-bottom: 1px solid var(--cg-line);
  padding: 16px 28px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.cg-topbar h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.cg-topbar p { margin: 2px 0 0; color: var(--cg-muted); font-size: 13px; }
.cg-content { padding: 24px 28px 48px; }

/* ---------- Cards / tables ---------------------------------------------- */
.cg-card {
  background: var(--cg-surface); border: 1px solid var(--cg-line);
  border-radius: var(--cg-radius); box-shadow: var(--cg-shadow);
  overflow: hidden; margin-bottom: 20px;
}
.cg-card__head {
  padding: 16px 20px; border-bottom: 1px solid var(--cg-line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.cg-card__title { font-weight: 600; font-size: 15px; margin: 0; }
.cg-card__body { padding: 20px; }

.cg-table { width: 100%; border-collapse: collapse; }
.cg-table th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: var(--cg-muted);
  padding: 12px 20px; background: #FCFCFD; border-bottom: 1px solid var(--cg-line);
  white-space: nowrap;
}
.cg-table td { padding: 14px 20px; border-bottom: 1px solid var(--cg-line); vertical-align: middle; }
.cg-table tbody tr:last-child td { border-bottom: 0; }
.cg-table tbody tr { transition: background .12s ease; }
.cg-table tbody tr:hover { background: #FCFCFD; }
.cg-table__wrap { overflow-x: auto; }

/* ---------- Buttons ------------------------------------------------------ */
.cg-btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: var(--cg-radius-sm);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
  text-decoration: none; white-space: nowrap;
}
.cg-btn:disabled { opacity: .55; cursor: not-allowed; }
.cg-btn--primary { background: var(--cg-brand); color: #fff; }
.cg-btn--primary:hover:not(:disabled) { background: var(--cg-brand-dark); }
.cg-btn--ghost { background: #fff; color: var(--cg-body); border-color: var(--cg-line); }
.cg-btn--ghost:hover:not(:disabled) { background: #F9FAFB; }
.cg-btn--danger { background: var(--cg-danger); color: #fff; }
.cg-btn--danger:hover:not(:disabled) { background: #B42318; }
.cg-btn--sm { padding: 6px 11px; font-size: 12.5px; }
.cg-btn--icon { padding: 7px 9px; }

/* ---------- Forms -------------------------------------------------------- */
.cg-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.cg-label { font-size: 13px; font-weight: 500; color: var(--cg-body); }
.cg-input, .cg-select {
  width: 100%; padding: 10px 12px; font-family: inherit; font-size: 14px;
  color: var(--cg-ink); background: #fff;
  border: 1px solid var(--cg-line); border-radius: var(--cg-radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.cg-input:focus, .cg-select:focus {
  outline: none; border-color: var(--cg-brand);
  box-shadow: 0 0 0 3px rgba(1, 40, 206, .12);
}
.cg-input::placeholder { color: #98A2B3; }

.cg-search { position: relative; }
.cg-search .cg-input { padding-left: 36px; }
.cg-search i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #98A2B3; font-size: 13px; pointer-events: none;
}

/* ---------- Badges ------------------------------------------------------- */
.cg-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.cg-badge--brand { background: var(--cg-brand-tint); color: var(--cg-brand); }
.cg-badge--success { background: var(--cg-success-tint); color: var(--cg-success); }
.cg-badge--warn { background: var(--cg-warn-tint); color: var(--cg-warn); }
.cg-badge--danger { background: var(--cg-danger-tint); color: var(--cg-danger); }
.cg-badge--muted { background: #F2F4F7; color: var(--cg-muted); }

/* ---------- Tabs --------------------------------------------------------- */
.cg-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--cg-line); padding: 0 20px; }
.cg-tab {
  padding: 12px 14px; background: none; border: 0; border-bottom: 2px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--cg-muted);
  cursor: pointer; transition: color .15s ease, border-color .15s ease;
}
.cg-tab:hover { color: var(--cg-ink); }
.cg-tab.is-active { color: var(--cg-brand); border-bottom-color: var(--cg-brand); font-weight: 600; }

/* ---------- Empty + loading --------------------------------------------- */
.cg-empty { padding: 56px 20px; text-align: center; color: var(--cg-muted); }
.cg-empty i { font-size: 30px; opacity: .35; display: block; margin-bottom: 12px; }
.cg-empty h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--cg-ink); }
.cg-empty p { margin: 0; font-size: 13px; }

.cg-skeleton {
  height: 14px; border-radius: 6px; margin: 10px 0;
  background: linear-gradient(90deg, #EEF0F4 25%, #F6F7F9 37%, #EEF0F4 63%);
  background-size: 400% 100%; animation: cg-shimmer 1.3s ease-in-out infinite;
}
@keyframes cg-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Toasts ------------------------------------------------------- */
.cg-toasts {
  position: fixed; bottom: 24px; right: 24px; z-index: 1080;
  display: flex; flex-direction: column; gap: 10px;
}
.cg-toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px; max-width: 400px; padding: 13px 15px;
  background: var(--cg-ink); color: #fff; border-radius: var(--cg-radius);
  box-shadow: var(--cg-shadow-lg); font-size: 13.5px;
  animation: cg-toast-in .22s cubic-bezier(.16,1,.3,1);
}
.cg-toast--success { background: #054F31; }
.cg-toast--error { background: #7A271A; }
.cg-toast i { margin-top: 2px; }
@keyframes cg-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Modal -------------------------------------------------------- */
.cg-modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .55);
  display: none; align-items: center; justify-content: center; z-index: 1070; padding: 20px;
}
.cg-modal-backdrop.is-open { display: flex; }
.cg-modal {
  background: #fff; border-radius: 14px; box-shadow: var(--cg-shadow-lg);
  width: 100%; max-width: 460px; overflow: hidden;
  animation: cg-modal-in .2s cubic-bezier(.16,1,.3,1);
}
@keyframes cg-modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.cg-modal__head { padding: 20px 22px 0; }
.cg-modal__title { margin: 0; font-size: 17px; font-weight: 600; }
.cg-modal__body { padding: 14px 22px 20px; color: var(--cg-body); }
.cg-modal__foot {
  padding: 14px 22px; background: #FCFCFD; border-top: 1px solid var(--cg-line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------- Login -------------------------------------------------------- */
.cg-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--cg-brand) 0%, #010F5C 100%); padding: 20px;
}
.cg-login__card {
  background: #fff; border-radius: 16px; box-shadow: var(--cg-shadow-lg);
  width: 100%; max-width: 400px; padding: 36px 32px;
}
.cg-login__brand { text-align: center; margin-bottom: 26px; }
.cg-login__brand h1 { margin: 0 0 4px; font-size: 21px; font-weight: 600; letter-spacing: -.3px; }
.cg-login__brand p { margin: 0; color: var(--cg-muted); font-size: 13.5px; }
.cg-alert {
  background: var(--cg-danger-tint); color: var(--cg-danger);
  border: 1px solid #FECDCA; border-radius: var(--cg-radius-sm);
  padding: 10px 12px; font-size: 13px; margin-bottom: 16px;
}

/* ---------- Utility ------------------------------------------------------ */
.cg-muted { color: var(--cg-muted); }
.cg-row { display: flex; align-items: center; gap: 10px; }
.cg-spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cg-stack { display: flex; flex-direction: column; gap: 2px; }
.cg-strong { font-weight: 600; }
.cg-mono { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .cg-sidebar { width: 68px; flex-basis: 68px; padding: 20px 8px; }
  .cg-sidebar__brand span, .cg-nav a span, .cg-sidebar__foot span { display: none; }
  .cg-nav a { justify-content: center; }
  .cg-content, .cg-topbar { padding-left: 16px; padding-right: 16px; }
}
