:root {
  --primary-brand: #1E3A8A;
  --primary-hover: #1D4ED8;
  --bg-main: #F8FAFC;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --border-color: #E2E8F0;
  --border-hover: #CBD5E1;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-dark: #94A3B8;
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* --- LOGIN OVERLAY --- */
#login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(8px);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  padding: 2.2rem 2rem;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.8rem;
}

.login-brand-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #0F172A;
}

.login-brand-title span {
  color: var(--primary-brand);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: #0F172A;
  font-size: 0.9rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-brand);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background: var(--primary-brand);
  color: #ffffff;
  border: none;
  border-radius: 7px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

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

/* --- SIDEBAR NAVIGATION --- */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-brand);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 1.1rem;
}

.sidebar-logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: #0F172A;
}

.sidebar-logo-text span {
  color: var(--primary-brand);
}

.sidebar-menu {
  padding: 1rem 0.75rem;
  flex: 1;
}

.menu-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.8rem 0.75rem 0.4rem 0.75rem;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 0.2rem;
}

.menu-item:hover {
  background: #F1F5F9;
  color: var(--primary-hover);
}

.menu-item.active {
  background: #EFF6FF;
  color: var(--primary-brand);
  border-left: 3px solid var(--primary-brand);
  font-weight: 600;
}

.menu-icon {
  margin-right: 0.6rem;
  font-size: 1rem;
}

.menu-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #E2E8F0;
}

.menu-item.active .menu-badge {
  background: var(--primary-brand);
  color: #ffffff;
  border: none;
}

/* --- MAIN CONTENT AREA --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-main);
}

/* --- TOP HEADER --- */
.top-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0.9rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #0F172A;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* NOTIFICATION BELL */
.notif-wrapper {
  position: relative;
}

.notif-btn {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  color: #334155;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  position: relative;
  transition: background 0.2s ease;
}

.notif-btn:hover {
  background: #F1F5F9;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary-hover);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 200;
}

.notif-dropdown.active {
  display: block;
}

.notif-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #0F172A;
}

.notif-list {
  max-height: 280px;
  overflow-y: auto;
}

.notif-item {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.82rem;
  cursor: pointer;
}

.notif-item:hover {
  background: #F8FAFC;
}

.notif-item strong {
  display: block;
  color: #0F172A;
}

.notif-item span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: #0F172A;
  font-weight: 500;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.78rem;
}

.btn-logout {
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  color: #475569;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  color: var(--primary-brand);
  background: #EFF6FF;
  border-color: var(--primary-brand);
}

/* --- PAGE CONTENT BODY --- */
.content-body {
  padding: 1.8rem;
  flex: 1;
}

/* --- METRIC STAT CARDS --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.03);
}

.metric-title {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: #0F172A;
  margin-top: 0.3rem;
}

/* --- CONTROLS BAR & SEARCH --- */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.search-input {
  padding: 0.6rem 1rem;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: #0F172A;
  font-size: 0.88rem;
  min-width: 280px;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-brand);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-pill {
  padding: 0.45rem 0.85rem;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  color: #475569;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-pill.active, .status-pill:hover {
  background: var(--primary-brand);
  color: #ffffff;
  border-color: var(--primary-brand);
}

/* --- DATA TABLE --- */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.04);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th {
  background: #F8FAFC;
  color: #64748B;
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #F1F5F9;
  vertical-align: middle;
  color: #334155;
}

tr:hover td {
  background: #F8FAFC;
}

.customer-name {
  font-weight: 600;
  color: #0F172A;
  font-size: 0.92rem;
}

.customer-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.material-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  font-size: 0.74rem;
  color: #1E293B;
  font-weight: 500;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 14px;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-pending { background: #FFEDD5; color: #C2410C; }
.status-contacted { background: #DBEAFE; color: #1E40AF; }
.status-quote_sent { background: #F3E8FF; color: #6B21A8; }
.status-closed { background: #DCFCE7; color: #15803D; }

.quick-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action-sm {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #1E293B;
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.btn-action-sm:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
}

.btn-wa {
  background: #F0FDF4;
  color: #15803D;
  border-color: #86EFAC;
  font-weight: 600;
}

/* TOAST */
#admin-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
}

.admin-toast {
  background: #FFFFFF;
  border-left: 4px solid var(--primary-brand);
  border: 1px solid #E2E8F0;
  border-left-width: 4px;
  padding: 0.8rem 1.1rem;
  border-radius: 6px;
  color: #0F172A;
  font-weight: 500;
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

.empty-state {
  padding: 2.5rem;
  text-align: center;
  color: var(--text-muted);
}
