/* ============================================================
   FAIRHALL BILLING SYSTEM — Main Stylesheet
   Theme: Clean White + Teal/Cyan | Font: Space Grotesk
   ============================================================ */

:root {
  --teal-50:  #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --sidebar-w: 240px;
  --topbar-h:  60px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.05);

  --font: 'Space Grotesk', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--slate-50);
  color: var(--slate-800);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- SIDEBAR ---- */
.fh-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--slate-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1000;
  transition: transform .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.fh-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.fh-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
  flex-shrink: 0;
}
.fh-brand-text { display: flex; flex-direction: column; }
.fh-brand-name { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; letter-spacing: .3px; }
.fh-brand-sub  { font-size: 10px; color: var(--slate-400); letter-spacing: .5px; text-transform: uppercase; }

.fh-nav { flex: 1; padding: 14px 10px; }
.fh-nav-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--slate-500);
  padding: 8px 8px 4px;
}
.fh-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--slate-400);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s ease;
  margin-bottom: 2px;
}
.fh-nav-item i { font-size: 15px; flex-shrink: 0; }
.fh-nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.fh-nav-item.active {
  background: linear-gradient(135deg, var(--teal-700), var(--teal-600));
  color: #fff;
  box-shadow: 0 2px 8px rgba(13,148,136,.4);
}

.fh-sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fh-user-info { display: flex; align-items: center; gap: 8px; flex: 1; overflow: hidden; }
.fh-user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.fh-user-details { display: flex; flex-direction: column; overflow: hidden; }
.fh-user-name  { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fh-user-role  { font-size: 10px; color: var(--slate-400); text-transform: capitalize; }
.fh-logout {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--slate-400); border-radius: var(--radius-sm);
  transition: all .15s ease; flex-shrink: 0;
}
.fh-logout:hover { background: rgba(239,68,68,.15); color: #ef4444; }

/* ---- MAIN CONTENT ---- */
.fh-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
}

/* ---- TOPBAR ---- */
.fh-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
}
.fh-sidebar-toggle {
  background: none; border: none;
  font-size: 20px; color: var(--slate-500);
  cursor: pointer; padding: 4px;
  border-radius: var(--radius-sm);
  transition: all .15s;
  display: none;
}
.fh-sidebar-toggle:hover { background: var(--slate-100); color: var(--slate-800); }
.fh-topbar-title { font-size: 16px; font-weight: 600; color: var(--slate-800); flex: 1; }
.fh-topbar-right { display: flex; align-items: center; gap: 12px; }
.fh-topbar-date  { font-size: 12px; color: var(--slate-400); font-weight: 500; }

/* ---- ALERTS ---- */
.fh-alerts { padding: 0 24px; padding-top: 16px; }
.fh-alert {
  border: none; border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500;
  padding: 12px 16px;
}
.fh-alert-success { background: var(--teal-50); color: var(--teal-800); border-left: 3px solid var(--teal-500); }
.fh-alert-error   { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }

/* ---- CONTENT ---- */
.fh-content { padding: 20px 24px 40px; }

/* ---- PAGE HEADER ---- */
.fh-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.fh-page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--slate-900);
  display: flex; align-items: center; gap: 10px;
}
.fh-page-header h1 i { color: var(--teal-600); }

/* ---- CARDS ---- */
.fh-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.fh-card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fh-card-header h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-700);
  margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.fh-card-header h5 i { color: var(--teal-600); }
.fh-card-body { padding: 22px; }

/* ---- STAT CARDS ---- */
.fh-stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
  transition: all .2s ease;
}
.fh-stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.fh-stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.fh-stat-icon.teal  { background: var(--teal-50);  color: var(--teal-600); }
.fh-stat-icon.blue  { background: #eff6ff; color: #2563eb; }
.fh-stat-icon.green { background: #f0fdf4; color: #16a34a; }
.fh-stat-icon.amber { background: #fffbeb; color: #d97706; }
.fh-stat-value { font-size: 22px; font-weight: 700; color: var(--slate-900); line-height: 1; }
.fh-stat-label { font-size: 12px; color: var(--slate-500); font-weight: 500; margin-top: 3px; }

/* ---- TABLE ---- */
.fh-table-wrap { overflow-x: auto; }
.fh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.fh-table thead tr { background: var(--slate-50); }
.fh-table thead th {
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--slate-500);
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}
.fh-table tbody tr { transition: background .1s; }
.fh-table tbody tr:hover { background: var(--teal-50); }
.fh-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  vertical-align: middle;
}
.fh-table tbody tr:last-child td { border-bottom: none; }

/* ---- BUTTONS ---- */
.btn-fh-primary {
  background: linear-gradient(135deg, var(--teal-600), var(--teal-700));
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  transition: all .2s ease;
  box-shadow: 0 2px 8px rgba(13,148,136,.3);
}
.btn-fh-primary:hover {
  background: linear-gradient(135deg, var(--teal-700), var(--teal-800));
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(13,148,136,.4);
}
.btn-fh-secondary {
  background: #fff;
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  transition: all .15s ease;
}
.btn-fh-secondary:hover { background: var(--slate-50); color: var(--slate-800); border-color: var(--slate-400); }
.btn-fh-danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none;
  transition: all .15s ease;
}
.btn-fh-danger:hover { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.btn-fh-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* ---- FORMS ---- */
.fh-form-section {
  margin-bottom: 28px;
}
.fh-form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--teal-600);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--teal-100);
  display: flex; align-items: center; gap: 6px;
}
.fh-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 5px;
  display: block;
}
.fh-input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--slate-800);
  background: #fff;
  transition: all .15s ease;
  outline: none;
}
.fh-input:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,.1);
}
.fh-input::placeholder { color: var(--slate-400); }
.fh-input-hint { font-size: 11px; color: var(--slate-400); margin-top: 4px; }

/* ---- BADGES ---- */
.fh-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: capitalize;
}
.fh-badge-draft    { background: var(--slate-100); color: var(--slate-600); }
.fh-badge-sent     { background: #eff6ff; color: #2563eb; }
.fh-badge-paid     { background: var(--teal-50); color: var(--teal-700); }
.fh-badge-cancelled{ background: #fef2f2; color: #dc2626; }
.fh-badge-invoice  { background: var(--teal-50); color: var(--teal-700); }
.fh-badge-proforma { background: #fdf4ff; color: #9333ea; }

/* ---- INVOICE FORM specific ---- */
.fh-service-row {
  background: var(--slate-50);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  position: relative;
  transition: border-color .15s;
}
.fh-service-row:hover { border-color: var(--teal-300); }
.fh-service-remove {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: none;
  color: var(--slate-400);
  cursor: pointer; font-size: 16px;
  transition: color .15s;
}
.fh-service-remove:hover { color: #ef4444; }

.fh-totals-panel {
  background: var(--slate-900);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  color: #fff;
}
.fh-totals-row {
  display: flex; justify-content: space-between;
  padding: 5px 0;
  font-size: 13.5px;
  color: var(--slate-300);
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.fh-totals-grand {
  display: flex; justify-content: space-between;
  padding: 12px 0 0;
  font-size: 18px; font-weight: 700; color: var(--teal-400);
}

/* ---- DASHBOARD CHART ---- */
.fh-chart-wrap { height: 200px; position: relative; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .fh-sidebar {
    transform: translateX(-100%);
  }
  .fh-sidebar.open {
    transform: translateX(0);
  }
  .fh-main {
    margin-left: 0;
  }
  .fh-sidebar-toggle { display: flex; }
  .fh-topbar { padding: 0 16px; }
  .fh-content { padding: 16px; }
}

/* ---- LOGIN PAGE ---- */
.fh-login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--teal-800) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.fh-login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(20,184,166,.15) 0%, transparent 70%);
  top: -100px; right: -100px;
  border-radius: 50%;
}
.fh-login-card {
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%; max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
  position: relative;
  z-index: 1;
}
.fh-login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.fh-login-logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  margin-bottom: 10px;
  box-shadow: 0 6px 20px rgba(13,148,136,.35);
}
.fh-login-title { font-size: 22px; font-weight: 700; color: var(--slate-900); }
.fh-login-sub   { font-size: 13px; color: var(--slate-400); margin-top: 3px; }

/* ---- UTILS ---- */
.text-teal   { color: var(--teal-600) !important; }
.text-muted-fh { color: var(--slate-400); font-size: 12px; }
.fw-600 { font-weight: 600; }
.gap-actions { display: flex; gap: 6px; align-items: center; }
