/* --- BASE VARIABLES (Defaults to 'Classic') --- */


* {
  box-sizing: border-box;
}

:root {
  --bg-color: #ece8e4;
  --text-color: #013601;
  --accent-color: #016f08;
  --card-bg: #FFFFFF;
  --header-bg: rgba(255, 255, 255, 0.9);
}

/* --- THEME MAPPING --- */
[data-theme="night"] {
  --bg-color: #121212;
  --text-color: #E0E0E0;
  --accent-color: #F4A261;
  --card-bg: #1E1E1E;
  --header-bg: rgba(18, 18, 18, 0.9);
}

[data-theme="espresso"] {
  --bg-color: #3E2723;
  --text-color: #EFEBE9;
  --accent-color: #D7A86E;
  --card-bg: #4E342E;
  --header-bg: rgba(62, 39, 35, 0.9);
}

[data-theme="cafe-sua"] {
  --bg-color: #F5E6D3;
  --text-color: #4A2C2A;
  --accent-color: #D48C4B;
  --card-bg: #FFFFFF;
  --header-bg: rgba(245, 230, 211, 0.9);
}

[data-theme="sunrise"] {
  --bg-color: #FFE5B4;
  --text-color: #4A2C2A;
  --accent-color: #fe592f;
  --card-bg: #FFF5E1;
  --header-bg: rgba(255, 229, 180, 0.9);
}

/* --- GLOBAL STYLES --- */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background-color: var(--header-bg);
  backdrop-filter: blur(5px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-color);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-container:hover {
  opacity: 0.8;
  /* Slight transparency */
  transition: opacity 0.2s;
}

.brand-logo {
  height: 80px;
  width: auto;
  border-radius: 45%;
  /* Makes the drawing look like a neat badge */
  object-fit: cover;
}

.theme-selector {
  display: flex;
  gap: 10px;
  align-items: center;
}

.theme-btn {
  background: transparent;
  border: 1px solid var(--accent-color);
  color: var(--text-color);
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: 0.2s;
}

.theme-btn:hover {
  background-color: var(--accent-color);
  color: #fff;
  /* Keeps text readable on hover */
  border-color: var(--accent-color);
}

/* --- HEADER RIGHT ALIGNMENT --- */
.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto;
  /* Pushes everything to the FAR RIGHT edge */
}

/* --- FLAG SWITCHER --- */
.lang-switcher a {
  text-decoration: none;
  font-size: 1.2rem;
  margin: 0 3px;
  transition: transform 0.2s;
}

.lang-switcher a:hover {
  transform: scale(1.2);
}

/* --- HAMBURGER MENU ICON --- */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  z-index: 1001;
  /* Sits above the sidebar */
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: var(--text-color);
  border-radius: 2px;
  transition: 0.3s;
}

/* --- SIDEBAR DRAWER --- */
.sidebar {
  height: 100vh;
  width: 0;
  position: fixed;
  z-index: 10000;
  /* Forces it ABOVE the header bar */
  top: 0;
  right: 0;
  background-color: var(--card-bg);
  border-left: 1px solid rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  overflow-x: hidden;
  transition: 0.3s;
  padding-top: 60px;
  box-shadow: -4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.open {
  width: 250px;
}

.sidebar .closebtn {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 36px;
  margin-left: 50px;
  text-decoration: none;
  color: var(--text-color);
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  padding: 0 20px 20px 20px;
  /* Bottom padding for the footer */
  gap: 15px;
}

.sidebar-links a {
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  transition: 0.2s;
}

.sidebar-links a:hover {
  color: var(--accent-color);
  transform: translateX(-5px);
}

.sidebar-divider {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 10px 0;
}

/* --- THEME BUTTONS INSIDE THE SIDEBAR --- */
.sidebar .theme-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 5px;
}

.sidebar .theme-selector span {
  font-size: 0.8rem;
  color: var(--text-color);
  margin-right: 5px;
  opacity: 0.7;
}

.sidebar .theme-btn {
  height: 24px;
  /* Slightly smaller for the sidebar */
  padding: 0 8px;
  font-size: 0.7rem;
  border-radius: 12px;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 640px) {
  .header-right {
    gap: 10px;
  }

  .lang-switcher a {
    font-size: 1rem;
  }

  .sidebar.open {
    width: 100%;
    /* Sidebar takes full width on phones */
  }
}

main {
  flex: 1;
  padding: 1rem 2rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
}

.cta-button {
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: opacity 0.2s;
}

.cta-button:hover {
  opacity: 0.9;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
  /* <--- Increased from 2.5rem */
}

.feature-card {
  background-color: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid transparent;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease;
}

/* --- FORM STYLING --- */
form {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  align-items: center;
  /* Perfectly centers labels & inputs vertically */
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  /* Prevents layout from breaking on small screens */
}

.form-group label {
  width: 150px;
  min-width: 150px;
  text-align: right;
  margin-right: 15px;
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.95rem;
  /* These are CRITICAL to fix the "cut off" borders */
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
  flex: 1;
  min-width: 120px;
  /* Prevents inputs from disappearing on tiny screens */
  padding: 10px 12px;
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: var(--card-bg);
  color: var(--text-color);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(182, 95, 34, 0.15);
}

/* Style specifically for dropdowns */
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234b5563' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

/* --- Combined SKU & Item Type row --- */
/* The container for the row */
.form-group .inline-group {
  display: flex;
  flex: 1;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* SKU Input: Takes up ALL the empty space */
.sku-input {
  flex: 1;
  min-width: 150px;
}

/* Makes the SKU input stretch all the way */
.input-full {
  flex: 1;
}

/* Makes the textarea stretch all the way and ensures it looks good */
.textarea-full {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: var(--card-bg);
  color: var(--text-color);
  font-family: inherit;
  resize: vertical;
  /* User can drag it taller if needed */
  min-height: 60px;
}

/* Shared row for Type and Stock */
.double-row {
  display: flex;
  flex: 1;
  gap: 25px;
  /* Space between Type and Stock groups */
  flex-wrap: wrap;
  /* Drops to their own lines if the screen is too narrow */
  align-items: center;
  /* Vertically centers the different heights */
}

/* The individual field groups inside the shared row */
.sub-field {
  display: flex;
  flex: 1;
  /* Each takes exactly 50% of the available space */
  align-items: center;
  /* Perfectly vertically centers the different heights */
  gap: 10px;
  min-width: 150px;
  max-width: 175px;
  /* Prevents them from getting smashed on tiny screens */
}

/* Labels inside the shared row (Type:, Stock:) */
.inline-label {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
}

/* --- PERFECTLY CENTERED DROPDOWN WRAPPER --- */
.type-wrapper {
  flex: 1;
  height: 30px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: var(--card-bg);
  box-sizing: border-box;

  /* MAGIC: This centers the text perfectly */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 16px;
  /* Prevents text from bumping the arrow */
  overflow: hidden;
  /* Kills the native ghost border behind it */
}

/* THE INVISIBLE SELECT (Takes the clicks) */
.type-select-clean {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  /* Fully invisible, but fully clickable */
  cursor: pointer;
  border: none;
  outline: none;
  appearance: none;
  padding: 0;
  margin: 0;
}

/* THE VISIBLE TEXT (Perfectly centered) */
.type-text {
  flex: 1;
  text-align: center;
  color: var(--text-color);
  font-size: 1rem;
  line-height: 30px;
}

/* THE CUSTOM DROPDOWN ARROW (Exactly one arrow, perfectly placed) */
.type-wrapper::after {
  content: '';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #4b5563;
  pointer-events: none;
}

/* Qty input: A little shorter (28px) */
.input-sub {
  flex: 1;
  min-width: 60px;
  height: 30px;
  /* Shorter to be compact */
  padding: 0 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: var(--card-bg);
  color: var(--text-color);
}

/* The Unit dropdown - allowing it to flow naturally */
.form-group .inline-group select.unit-select {
  width: auto;
  min-width: 80px;
  /* Doesn't force 120px, just goes to 80px and grows naturally */
  flex: 0 1 auto;
  /* Only takes as much space as it needs */
}

.form-group .helper-text {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 4px;
}

/* Button styling */
form button {
  flex: 1;
  padding: 12px;
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: opacity 0.2s;
}

form button:hover {
  opacity: 0.9;
}

/* --- DASHBOARD STAT CARDS --- */
.dashboard-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 2rem;
}

.stat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 20px;
  border-radius: 5px;
  /* pill shape */
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
  /* dark text for contrast */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.2s;
  text-decoration: none;
}

.stat-button:hover {
  transform: scale(1.05);
}

/* Pastel colors */
.stat-button.green {
  background-color: #d1fae5;
  color: #065f46;
}

.stat-button.blue {
  background-color: #dbeafe;
  color: #1e40af;
}

.stat-button.pink {
  background-color: #fce7f3;
  color: #9d174d;
}

.stat-button.purple {
  background-color: #ffcbff;
  color: #a10470;
}

.stat-button.beige {
  background-color: #fef3c7;
  color: #92400e;
}

.stat-button .number {
  margin-left: 5px;
  background: rgba(255, 255, 255, 0.5);
  padding: 0 6px;
  border-radius: 10px;
}

.stat-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--text-color);
  font-weight: normal;
}

.stat-number {
  font-size: 2.8rem;
  font-weight: bold;
  color: var(--accent-color);
}

.action-card {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 1.5rem;
}

.action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.1);
}

.card-header {
  padding: 12px 18px;
  font-weight: 600;
  color: #1f2937;
}

.card-body {
  padding: 12px 18px 18px 18px;
  color: #4b5563;
  font-size: 0.95rem;
}

/* Color themes for cards */
.card-client .card-header {
  background-color: #d8b4fe;
}

/* solid light purple */
.card-client .card-body {
  background-color: #f3e8ff;
}

/* pastel light purple */

.card-inventory .card-header {
  background-color: #fcd34d;
}

/* solid light yellow/beige */
.card-inventory .card-body {
  background-color: #fef3c7;
}

/* pastel beige */

.card-orders .card-header {
  background-color: #93c5fd;
}

/* solid light blue */
.card-orders .card-body {
  background-color: #dbeafe;
}

/* pastel blue */

.card-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- CLIENT TABLE --- */
.client-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.client-table th,
.client-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.client-table th {
  background: var(--accent-color);
  color: #fff;
  font-weight: 600;
}

.client-table tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* --- TABS --- */
.client-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tabs {
  margin-top: 1rem;
}

.tabs input[type="radio"] {
  display: none;
}

.tabs label {
  display: inline-block;
  padding: 10px 20px;
  background: var(--card-bg);
  border: 1px solid #ccc;
  border-bottom: none;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  margin-right: 4px;
  font-weight: bold;
  color: var(--text-color);
}

.tabs input[type="radio"]:checked+label {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

.tab-content {
  display: none;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 0 8px 8px 8px;
  background: var(--card-bg);
}

#tab1:checked~#content1 {
  display: block;
}

#tab2:checked~#content2 {
  display: block;
}

/* --- CALENDAR --- */
.mini-calendar {
  max-width: 280px;
  margin: 15px 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  background: var(--card-bg);
}

.cal-header {
  text-align: center;
  font-weight: bold;
  margin-bottom: 8px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 0.8rem;
}

.cal-day {
  padding: 4px;
  border-radius: 4px;
}

.cal-day.has-event {
  background: var(--accent-color);
  color: #fff;
  font-weight: bold;
  border-radius: 50%;
}

.cal-day.empty {
  color: #ccc;
}

/* --- DIARY LIST --- */
.diary-list {
  list-style: none;
  padding: 0;
}

.diary-list li {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.diary-date {
  font-weight: bold;
  color: var(--accent-color);
  margin-right: 8px;
}

/* ----------------------------
/*    INVENTORY MODULE
/* ---------------------------- */
/* --- RESPONSIVE INVENTORY HEADER --- */
.client-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  /* Ensures buttons drop below on tiny screens */
  gap: 10px;
  margin-bottom: 1rem;
}

/* Title max-width 50%, shrinks font on mobile */
.item-title {
  flex: 1;
  max-width: 50%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.5rem;
  /* Desktop size */
  margin: 0;
  transition: font-size 0.3s ease;
}

/* Right-side buttons row */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- TAB PANELS (Hides/Shows the forms) --- */
.tab-panel {
  display: none !important;
  /* Hides the panel by default */
}

.tab-panel.active-panel {
  display: block !important;
  /* Shows the panel when active */
}

/* Details & Costs Buttons (Exact same size as Theme buttons) */
.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #1f2937;
  background-color: #e5e7eb;
  /* Light gray when inactive */
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.tab-btn.active {
  background-color: var(--accent-color);
  /* Theme color when active */
  color: #fff;
}

/* --- INVENTORY IMAGE UPLOAD (Matches Settings logo style) --- */

/* --- INVENTORY IMAGE UPLOAD WRAPPER --- */
.inventory-image-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: nowrap !important;
  /* CRITICAL: Forbids wrapping */
}

.inventory-image-input-wrap {
  flex: 1;
  /* Makes the browse field wide */
  height: 40px;
  padding: 6px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: var(--card-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.inventory-image-input-wrap input[type="file"] {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0 10px;
  background: transparent;
  box-sizing: border-box;
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
}

/* --- SLIMMED DOWN UPLOAD BUTTON --- */
.inventory-upload-btn {
  height: 37px;
  /* Keep it aligned with the input */
  padding: 0 14px;
  font-size: 0.8rem;
  /* Smaller text */
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  flex: 0 0 auto;
  /* Prevents it from stretching */
  white-space: nowrap;
  /* Prevents the word 'Upload' from breaking */
}

.inventory-upload-btn:hover {
  background-color: #a04e1a;
}




.upload-preview-area {
  flex: 0 0 auto;
  min-width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- BROWSE BUTTON (Exactly 37px, simple grey) --- */
.browse-btn {
  display: inline-block;
  height: 37px;
  line-height: 37px;
  padding: 0 16px;
  background-color: #f3f4f6;
  border: 1px solid #9ca3af;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.2s;
  box-sizing: border-box;
}

.browse-btn:hover {
  background-color: #e5e7eb;
}

/* --- CLEAN LOGO UPLOAD WRAPPER --- */
.logo-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

/* Native input exactly 37px tall, slightly shorter width */
.logo-upload-row input[type="file"] {
  height: 37px !important;
  /* The exact height you asked for */
  padding: 6px 10px 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: var(--card-bg);
  color: var(--text-color);
  box-sizing: border-box;
  cursor: pointer;
  flex: 1;
  /* Takes up available space */
  max-width: 300px;
  /* Shortens it so the image sits next to it */
  min-width: 150px;
  /* Prevents it from getting crushed too small */
}

/* The thumbnail */
.logo-thumb {
  height: 70px;
  width: auto;
  max-width: 70px;
  border: 2px solid #a7c7f8;
  border-radius: 6px;
  padding: 2px;
  display: none;
  object-fit: contain;
}

.logo-thumb.visible {
  display: block;
}

/* The native input fills the wrapper 100% */
.logo-input-wrap input[type="file"] {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0 10px;
  background: transparent;
  box-sizing: border-box;
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
}

.logo-input-wrap input[type="file"] {
  width: 100%;
  height: 100%;
  border: none;
  padding: 0 10px;
  background: transparent;
  box-sizing: border-box;
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
}


/* --- PROFESSIONAL AMBER FLASH MESSAGES --- */
.flash-messages {
  display: block !important;
  visibility: visible !important;
  position: relative !important;
  width: 100% !important;
  max-width: 800px !important;
  margin: 20px auto 20px auto !important;
  padding: 12px 18px !important;

  /* Soft amber/yellow background */
  background-color: #fffbeb !important;
  border: 1px solid #fde68a !important;
  border-left: 4px solid #f59e0b !important;
  /* Left accent border for style */
  border-radius: 6px !important;
  color: #92400e !important;
  /* Dark brown text */
  font-weight: 500 !important;
  font-size: 1rem !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
  z-index: 9999 !important;
}

.flash-messages p {
  margin: 0 !important;
  text-align: center !important;
}

/* --- INVENTORY IMAGE DELETE BUTTON --- */
.img-delete-btn {
  position: absolute !important;
  top: -8px !important;
  right: -8px !important;
  width: 24px !important;
  height: 24px !important;
  background-color: #ef4444 !important;
  /* Force it red */
  color: #ffffff !important;
  /* Force white X */
  border: 2px solid #ffffff !important;
  /* White border to pop off the image */
  border-radius: 50% !important;
  /* Force it perfectly round */
  font-size: 14px;
  line-height: 1;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
  transition: transform 0.2s;
}

.img-delete-btn:hover {
  transform: scale(1.15) !important;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
  .item-title {
    max-width: 40%;
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .client-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .item-title {
    max-width: 100%;
    white-space: normal;
    font-size: 1rem;
    margin-bottom: 5px;
  }

  .header-actions {
    width: 100%;
    gap: 5px;
  }

  .tab-btn,
  .header-actions a {
    height: 26px;
    /* Shrink buttons slightly on phone */
    padding: 0 12px;
    font-size: 0.75rem;
  }
}


/* --- PERFECTLY CENTER UNIT DROPDOWN --- */
select.unit-select {
  height: 30px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: var(--card-bg);
  color: var(--text-color);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 640px) {
  main {
    padding: 1rem;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
  }

  /* Switch from Grid to Flexbox for perfect centering on mobile */
  .card-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* This forces the card boxes to center perfectly */
    gap: 1.5rem;
    margin-top: 2rem;
    width: 100%;
  }

  /* The cards now take up 75% width and are exactly centered */
  .action-card {
    width: 75%;
    display: block;
    /* No margin auto needed anymore—align-items: center handles it */
  }

  .dashboard-stats {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: center;
    /* Centers the badges too */
  }

  .stat-button {
    font-size: 0.8rem;
    height: 26px;
    padding: 0 12px;
  }
}