/* Mobile-first styles */
:root {
  --primary: #46A138;
  --primary-dark: #3d8a2f;
  --secondary: #64748b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1d242f;
  --text-light: #64748b;
  --text-dark: #070708;
  --border: #e2e8f0;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --radius: 8px;
  --font-sm: font-size:10px;
  --font-md: font-size:14px;
  --font-lg: font-size:18px;
}

/* John Deere Colors */
:root {
  --jd-green: #367C2B;          /* Active */
  --jd-green-light: #4FAF3A;    /* Active hover */
  --jd-yellow: #FFDE00;         /* Inactive */
  --jd-yellow-light: #FFE84D;
  --kuhn-red: #C61E12;          /* Kuhn Red */
  --milwaukee: #c8102e;         /* Milwaukee Red */
  --jd-construction: #D5A22F;   /* JD Construction Yellow */
}
.font-sm{font-size: 10px;}
.font-md{font-size: 14px;}
.font-lg{font-size: 18px;}

.card p.font-sm{font-size: 10px;}
.card p.font-md{font-size: 14px;}
.card p.font-lg{font-size: 18px;}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.5;
}

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.15rem;
}
header h1 span {
  font-size: .7em; /* Adjust this size for your second line */
  /*  display: block; Ensures the second line drops down to the next line */
  font-weight: normal; /* Optional: Makes the second line lighter */
}
header h1 {
  white-space: nowrap;
}
header h1 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media screen and (min-width: 425px) and (max-width: 480px) {
  header h1 {
    font-size: .75rem;
  }
  header h1 span {
    font-size: 0.25em;
  }
}


#menu-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* Navigation */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 50px;
  z-index: 99;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
}

nav.show {
  display: flex;
}

nav button {
  display: inline-flex;
  flex: 1 1 auto;
  min-width: 110px;
  justify-content: center;
  padding: 0.75rem 0.85rem;
  color: var(--text-light);
  background: var(--background);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

nav button:hover {
  color: var(--text);
  background: #f1f5f9;
  border-color: var(--border);
}

nav button.active {
  color: white;
  background: var(--primary);
  border-color: var(--primary-dark);
}

@media (max-width: 768px) {
  nav {
    position: static;
    top: auto;
    padding: 0.5rem;
    font-size: 1.5rem;
  }

  nav button {
    flex: 1 1 100%;
    min-width: auto;
  }
  nav button.active {
    color: white;
    background: var(--primary);
    border-color: var(--primary-dark);
  }
}

/* Section */

section.view h4{font-size: 1.4rem;}

/* Main content */
main {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: var(--text-light);
}

/* Parts Search and Bins */
.bin-group {
  margin-bottom: 25px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
}

.bin-header {
  margin: 0;
  padding: 8px 12px;
  background: #e8e8e8;
  border-radius: 4px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.arrow {
  font-size: 1rem;
  width: 16px;
  display: inline-block;
}

.bin-content {
  padding: 10px 5px 5px 5px;
}

.bin-content.collapsed {
  display: none;
}

.low-stock {
  border-left: 6px solid #d9534f;
}

.card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.search-sort-controls {
  margin-bottom: 20px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.search-input,
.range-input {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  flex: 1;
}

.sort-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.sort-bar button {
  padding: 8px 12px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

.sort-bar button:hover {
  background: #e0e0e0;
}

.hidden {
  display: none;
}

.search-mode-select {
  margin-bottom: 10px;
  text-align:center;
  
}
.search-mode-select p{
  padding:.5rem;
}

.mode-btn {
  margin-right: 8px;
  padding: 6px 12px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-light);
}


/* TASKS */
.done {
  text-decoration: line-through;
  opacity: 0.6;
}
.task-check {
  width: auto;
  height: auto;
  margin: 0;
}

.task-text{font-size: 1.1rem}
.task-label {
  display: flex;
  align-items: center; /* centers checkbox + text vertically */
  gap: 8px;            /* optional spacing */
}



/* Card Grid */
.card-grid {
  display: grid;
  gap: 0.75rem;
}

.card {
  background: var(--surface);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  display: flex;
  flex-direction: column;
}

.card button {
  width: auto;          /* stops 100% width */
  display: inline-flex; /* keeps them tight */
}

.card .edit-btn,
.card .delete-btn {
  margin-right: 8px;    /* spacing between them */
}

.card .edit-btn + .delete-btn {
  margin-left: 0;       /* prevents double spacing */
}

.card-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.card-title,
.card-number {
  font-size: 1rem;
  font-weight: 600;
}

.card-title {
  color: var(--text);
}

.card-number {
  text-align: right;
  white-space: nowrap;
  color: var(--text-light);
}
.card-price{
  text-align: right;
  white-space: nowrap;
  color: var(--text-light);


}
.card h4{font-size: 1.29rem}
.card p {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}
.card p.font-lg{
  font-size: 1.125rem;
  color: var(--text-dark);
}

.card-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 1rem;
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.badge.active { background: #dcfce7; color: #166534; }
.badge.completed { background: #dbeafe; color: #1e40af; }
.badge.on-hold { background: #fef3c7; color: #92400e; }
.badge.pending { background: #f1f5f9; color: #475569; }
.badge.high { background: #fee2e2; color: #991b1b; }
.badge.medium { background: #fef3c7; color: #92400e; }
.badge.low { background: #dcfce7; color: #166534; }
.low-stock {
  border-left: 6px solid #d9534f;
}

#parts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  padding: 10px;
}

/* Search and Sort Controls */
.search-sort-controls {
  background: var(--surface);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.search-help {
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0 0 0.75rem;
}

.search-input {
  flex: 2;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.range-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.search-input:focus,
.range-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(70, 161, 56, 0.1);
}

.sort-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bin-search-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.bin-btn {
  padding: 6px 12px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.bin-btn:hover {
  background: #0056b3;
}


@media (max-width: 768px) {
  .search-row {
    flex-direction: column;
  }
  
  .search-input,
  .range-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .sort-buttons {
    flex-direction: column;
  }
  
  .sort-btn {
    width: 100%;
  }
}

.sort-btn {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

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

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

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

.btn-add {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--jd-green);
  color: white;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-add:hover {
  background: var(--jd-green-light);
  transform: translateY(-2px);
}


.btn-add .icon {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1); /* makes dark icons white */
}

.edit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #367C2B; /* John Deere Green */
  color: white;
  padding: 5px 9px;
  border: none;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.edit-btn:hover {
  background: #2B5F22; /* darker JD green */
  transform: translateY(-2px);
}

.delete-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #C62828; /* Red */
  color: white;
  padding: 5px 9px;
  border: none;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.delete-btn:hover {
  background: #8E1C1C; /* darker red */
  transform: translateY(-2px);
}


/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow: visible;
}
.modal-content {
  position: static;
}

.modal-content h3 {
  margin-bottom: 1rem;
}

.close {
  float: right;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

select, textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  width: 100%;
}
input {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  
}
textarea {
  min-height: 180px;
  resize: vertical;
}

button[type="submit"] {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
}

button[type="submit"]:hover {
  background: var(--primary-dark);
}


/* Base button styling */
.mode-btn {
  padding: 10px 18px;
  margin: 5px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;

  /* Default = inactive (yellow) */
  background: var(--jd-yellow);
  color: #000;
}

/* Hover on inactive buttons */
.mode-btn:hover {
  background: var(--jd-yellow-light);
  transform: translateY(-2px);
}

/* ACTIVE BUTTON = GREEN */
.mode-btn.active {
  background: var(--jd-green);
  color: white;
}

/* Hover on active button */
.mode-btn.active:hover {
  background: var(--jd-green-light);
}





#fluid-machines-list, #other-business-list{padding-top:.75rem;}
#customers-list{padding-top:2.5rem;}
#add_cust.btn-add{margin-top:1rem;margin-bottom: .5rem;}
#add_business.btn-add{margin-top:1rem;margin-bottom: .5rem;}
#add_machine.btn-add{margin-top:1rem;margin-bottom: .5rem;}
#add-co-worker-btn.btn-add{margin-top:1rem;margin-bottom: .5rem;}
#add_task.btn-add{margin-top:1rem;margin-bottom: .5rem;}
#add_note.btn-add{margin-top:1rem;margin-bottom: .5rem;}


.home-card.nav-btn.customer-card {border-left: 1px solid var(--jd-green);border-bottom: 4px solid var(--jd-green);border-right: 3px solid var(--jd-green);border-top: 1px solid var(--jd-green);}
.home-card.nav-btn.parts-card {border-left: 1px solid var(--jd-green);border-bottom: 4px solid var(--jd-green);border-right: 3px solid var(--jd-green);border-top: 1px solid var(--jd-green);}
.home-card.nav-btn.fluid-card {border-left: 1px solid var(--jd-green);border-bottom: 4px solid var(--jd-green);border-right: 3px solid var(--jd-green);border-top: 1px solid var(--jd-green);}
.home-card.nav-btn.other_business-card {border-left: 1px solid var(--jd-green);border-bottom: 4px solid var(--jd-green);border-right: 3px solid var(--jd-green);border-top: 1px solid var(--jd-green);}
.home-card.nav-btn.co-worker-card {border-left: 1px solid var(--jd-green);border-bottom: 4px solid var(--jd-green);border-right: 3px solid var(--jd-green);border-top: 1px solid var(--jd-green);}
.home-card.nav-btn.tasks-card {border-left: 1px solid var(--jd-green);border-bottom: 4px solid var(--jd-green);border-right: 3px solid var(--jd-green);border-top: 1px solid var(--jd-green);}
.home-card.nav-btn.notes-card {border-left: 1px solid var(--jd-green);border-bottom: 4px solid var(--jd-green);border-right: 3px solid var(--jd-green);border-top: 1px solid var(--jd-green);}

.call-link {
    padding: 4px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    margin-right: 8px;
}
.call-link.call.first { margin-left: 10px; }
.call-link.call { background: #28a745; }
.call-link.msg  { background: #007aff; }

.co-worker-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  
  white-space: nowrap;
  font-size: 1rem;
}
.co-worker-actions {
  white-space: nowrap;
}
.co-worker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.call-link {
  display: inline-block;
}
a.co-email{
  color: var(--jd-green);
  text-decoration: none;
  font-size: 1rem;
}

/* Customer Search */
/* Customer Search – minimized but preserves original behavior */
#customers #customer-search {
  position: sticky;
  top: 80px;
  z-index: 20;
  background: white;
  width: 100%;
  display: block;
  box-sizing: border-box;
}

#customer-search.search-input {
  padding: 16px 0;
  height: 52px;
  line-height: 52px;
  font-size: 18px;
  width: 100%;
  display: block;
  box-sizing: border-box;
}

/* Sticky Parts Search + Sort Bar */
#parts .search-mode-select,
#parts #search-bar-container {
  position: sticky;
  top: 60px; /* adjust if your header height changes */
  z-index: 50;
  background: #fff;
  padding: 10px 0;
}

/* FLUID Search */

#fluid-machine-search {
  position: sticky;
  top: 80px;          /* matches your layout */
  z-index: 50;
  background: white;
  width: 100%;
  display: block;
  box-sizing: border-box;

  padding: 16px;      /* internal space */
  height: 52px;       /* iPhone visual height */
  line-height: 52px;  /* iPhone respects this */
  font-size: 18px;    /* looks good */
}

/* Keep the two bars together visually */
#parts .search-mode-select {
  border-bottom: 1px solid #ddd;
}

#parts #search-bar-container {
  border-bottom: 2px solid #ccc;
}

/* Ensure the parts list scrolls normally */
#parts-list {
  margin-top: 10px;
}



/* Recent section */
.recent-section {
  background: var(--surface);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Home grid */
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 1.5rem .5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  cursor: pointer;
  width: 100%;
}

.home-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.home-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.home-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.home-label {
  font-size: 1rem;
  font-weight: 500;
}

.home-icon img {
  width: 48px;
  height: 48px;
  display: block;
  margin: 0 auto 8px;
  opacity: 0.9;
}

.home-icon i {
  font-size: 40px;
  margin-bottom: 8px;
}
.home-icon img,
.home-icon i {
  width: 48px;
  height: 48px;
  font-size: 48px;
  display: block;
  margin: 0 auto 8px;
  opacity: 0.9;
}

/* OTHER BUSINESS MODALS */

#other-business-modal .row {
  display: flex;
  gap: 10px;
}

#other-business-modal .row input {
  flex: 1;
}
#edit-business-modal .row {
  display: flex;
  gap: 10px;
}

#edit-business-modal .row input {
  flex: 1;
}

/* END */

/* MODAL OVERLAY */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  overflow: hidden; /* prevent page scroll */
}

/* Modal active */
.modal.active {
  display: flex;
}

/* Modal content scroll fix */
.modal-content {
  background: var(--surface);
  padding: 1.2rem;
  border-radius: var(--radius);
  width: 100%;
  max-width: 450px;

  /* ⭐ THIS IS THE FIX ⭐ */
  max-height: 90vh;
  overflow-y: auto;

  /* Smooth scrolling inside modal */
  scrollbar-width: thin;
}

/* Row layout for City / State / Zip */
.modal-content .row {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-wrap: nowrap;
}
.modal-content .row input,
.modal-content .row select {
  min-width: 0; /* ⭐ CRITICAL — allows shrinking */
}


/* override the generic flex:1 */

/* City should be widest */
.modal-content .row input[name="city"] {
  flex: 2;
}

/* State should be narrow */
.modal-content .row input[name="state"] {
  flex: 0.8;
}

/* ZIP medium */
.modal-content .row input[name="zip"] {
  flex: 1;
}
.modal-content {
  box-sizing: border-box;
  overflow-y: auto;
  max-height: calc(100vh - 40px); /* iPhone-safe */
  padding-bottom: 80px; /* space for Save button */
}
.modal-content .save-btn {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding: .7rem 0;
}

/* END MODAL OVERLAY */

/* Tablet and up */
@media (min-width: 768px) {
  .home-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .btn-add {
    width: auto;
  }

  #menu-toggle {
    display: none;
  }

  nav ul {
    display: flex;
    flex-wrap: wrap;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Default: desktop */
#menu-toggle {
  display: none;
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
}

@media (max-width: 768px) {
  /* Mobile: show hamburger */
  #menu-toggle {
    display: block;
  }

  /* Mobile: hide nav by default */
  #main-nav {
    display: none;
    flex-direction: column;
    background: #333;
    padding: 10px;
    font-size: 1.5rem
  }

  /* Mobile: show nav when toggled */
  #main-nav.show {
    display: flex;
  }

  /* Mobile nav button styling */
  #main-nav .nav-btn {
    margin: 5px 0;
    width: 100%;
    text-align: left;
    color: rgb(0, 0, 0);
  }
  #main-nav .nav-btn.active{
    color: rgb(255, 255, 255);
  }
  
}

@media (max-width: 768px) {
  #main-nav {
    position: fixed;
    top: 50px; /* adjust based on your hamburger height */
    left: 0;
    width: 100%;
    background: #333;
    padding: 10px;
    display: none;
    flex-direction: column;
    z-index: 9999; /* stays above everything */
  }

  #main-nav.show {
    display: flex;
  }

  #main-nav .nav-btn {
    width: 100%;
    text-align: left;
    padding: 12px;
    color: white;
    background: none;
    border: none;
    font-size: 18px;
  }
}


/* ============================
   MTD Sales Progress Bar
============================ */
.mtd-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.mtd-label {
  color: var(--text-light);
}

.mtd-value {
  font-weight: 600;
  color: var(--text);
}

/* Progress bar container */
#mtd-progress-bar {
  width: 100%;
  height: 14px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 0.75rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}

/* Progress bar fill */
#mtd-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 8px;
  transition: width 0.4s ease;
}

/* MTD History Page Styling */
#mtd-history h2 {
  margin-bottom: 12px;
  font-size: 22px;
  font-weight: 600;
}

#mtd-history-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#mtd-history-table th {
  background: #2a7f62;
  color: white;
  padding: 10px;
  text-align: left;
  font-size: 14px;
}

#mtd-history-table td {
  padding: 10px;
  font-size: 14px;
  border-bottom: 1px solid #ddd;
}

#mtd-history-table tr:last-child td {
  border-bottom: none;
}

#mtd-history-table button.edit-btn {
  padding: 4px 8px;
  font-size: 12px;
  background: #2a7f62;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
}

#mtd-history-table button.edit-btn:hover {
  background: #256d55;
}

#mtd-sales-card .mtd-history-btn {
  margin-top: 15px;
  padding: 4px 8px;
  font-size: 9px;
  background: var(--jd-green-light);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center !important;
  display: block;
}

#mtd-sales-card .mtd-history-btn:hover  {
  background: var(--jd-green);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* smooth iPhone scrolling */
}

/* Default: normal table */
#mtd-history-table {
  width: 100%;
  border-collapse: collapse;
}

/* Mobile reflow */
@media (max-width: 600px) {
  #mtd-history-table thead {
    display: none; /* hide header on phone */
  }

  #mtd-history-table tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px;
    background: #fff;
  }

  #mtd-history-table td {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    border: none !important;
    font-size: 14px;
  }

  #mtd-history-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #333;
  }
}


/* ============================
   NOTES MODULE — FULL CSS PACK
   ============================ */

/* --- Filter Inputs --- */
#notes-page .search-input {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  background: #fafafa;
}

#notes-page select.search-input {
  cursor: pointer;
}

/* --- Page Header Spacing --- */
#notes-page .page-header {
  margin-bottom: 12px;
}

#notes-page input,
#notes-page select {
  margin-bottom: 10px;
}

/* --- Notes Grid Layout --- */
#notes-list {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

#noteBody {
  min-height: 180px;
  height: 180px;
  resize: vertical;
}

/* --- Note Card --- */
.note-card {
  background: white;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.note-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.note-card h3 {
  margin: 6px 0;
  font-size: 18px;
}

.note-body {
  font-size: 14px;
  color: #444;
  margin: 8px 0;
}
.note-body {
  white-space: pre-wrap;
}
.note-card-title {
  font-size: 18px;
  font-weight: 600;
}

.note-card-body {
  font-size: 14px;
  color: #444;
}
.note-card-body {
  
}

.notes-content {
  margin-top: 8px;
  white-space: pre-line;
  transition: max-height 0.25s ease;
  overflow: hidden;
}

.notes-content.collapsed {
  max-height: 0;
  padding: 0;
  opacity: 0;
}

.notes-content:not(.collapsed) {
  max-height: 500px; /* plenty for notes */
  opacity: 1;
}

.notes-toggle {
  margin-top: 8px;
  cursor: pointer;
  background: #ddd;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
}

/* Pin button */
.pin-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  opacity: 0.6;
  display: flex;
  align-items: center;
  transition: opacity 0.15s ease;
}

.pin-btn:hover {
  opacity: 1;
}

.note-card.pinned {
  border-left: 4px solid gold;
}
.note-card-body p{padding-top:.2rem; padding-bottom: .2rem;}
.note-card-body ul {
  margin-left: 18px;
  padding-left: 12px;
  list-style-position: outside;
}

.note-card-body ul li {
  margin: 4px 0;
  padding-left: 4px;
}

/* Title row to align title + pin button */
.note-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Note Meta --- */
.note-meta {
  margin-top: 10px;
  font-size: 12px;
  color: #777;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Topic Badge --- */
.topic-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* --- Keyword Tag Chips --- */
.note-tags {
  margin-top: 6px;
}
.keyword-wrapper {
  width: 100%;
  max-width: 400px;
}

#keyword-suggestions {
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
  margin-top: 4px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 200px;
}

.suggestion-item {
  display: block;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



.tag-chip {
  display: inline-block;
  background: #e5e5e5;
  color: #333;
  padding: 3px 8px;
  margin: 2px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

/* --- Pinned Icon --- */
.pinned-icon {
  font-size: 16px;
  margin-left: 8px;
  color: #ffcc00;
}

.suggestions {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 2px;
  width: calc(100% - 20px);
  max-height: 150px;
  overflow-y: auto;
  z-index: 999;
  display: none;
}

.suggestion-item {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
}

.suggestion-item:hover {
  background: #f0f0f0;
}


/* ============================
   SVG LINE-ART FILTER ICONS
   ============================ */

.svg-filter {
  position: relative;
  width: 100%;
}

.svg-filter input,
.svg-filter select {
  padding-left: 40px !important;
}

/* Base icon pseudo */
.svg-filter::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background: #777;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

/* Search icon */
.svg-search::before {
  mask-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24">\
<circle cx="11" cy="11" r="7"/>\
<line x1="16" y1="16" x2="22" y2="22"/>\
</svg>');
}

/* Topic / Tag icon */
.svg-topic::before {
  mask-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24">\
<path d="M4 4h10l6 6-10 10-6-6z"/>\
<circle cx="9" cy="9" r="2"/>\
</svg>');
}

/* Customer / User icon */
.svg-customer::before {
  mask-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24">\
<circle cx="12" cy="8" r="4"/>\
<path d="M4 20c1.5-3 4-4.5 8-4.5s6.5 1.5 8 4.5"/>\
</svg>');
}

/* Part / Puzzle icon */
.svg-part::before {
  mask-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24">\
<path d="M8 3h4a2 2 0 0 1 2 2v1a2 2 0 1 0 0 4v1a2 2 0 0 1-2 2h-1a2 2 0 1 0-4 0H6a2 2 0 0 1-2-2V9a2 2 0 1 0 0-4V5a2 2 0 0 1 2-2z"/>\
</svg>');
}

/* Date icon */
.svg-date::before {
  mask-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24">\
<rect x="3" y="5" width="18" height="16" rx="2"/>\
<line x1="3" y1="10" x2="21" y2="10"/>\
<line x1="9" y1="3" x2="9" y2="7"/>\
<line x1="15" y1="3" x2="15" y2="7"/>\
</svg>');
}

/* Sort icon */
.svg-sort::before {
  mask-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="black" stroke-width="2" viewBox="0 0 24 24">\
<path d="M8 4l-3 3 3 3"/>\
<line x1="5" y1="7" x2="19" y2="7"/>\
<path d="M16 20l3-3-3-3"/>\
<line x1="5" y1="17" x2="19" y2="17"/>\
</svg>');
}