/* ==================== COMPACT CSS ==================== */
:root {
  /* Light mode colors */
  --bg: #fdfdfd;
  --white: #ffffff;
  --text: #111827;
  --border: #e5e7eb;
  --muted: #6b7280;
  --error: rgba(255, 0, 0, 0.3);
  --shadow-color: rgba(0,0,0,0.1);
  --group-bg: #f3f4f6;
  --button-bg: #f9fafb;
  --button-hover: #f3f4f6;
  --modal-bg: rgba(0,0,0,0.5);
  --print-color: #0066CC;
  --popup-category-color: var(--print-color);

  /* Spacing */
  --xs: 0.1rem;
  --sm: 0.2rem;
  --md: 0.4rem;
  --lg: 1rem;

  /* Typography */
  --font: Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.85rem;
  --fs-base: 0.9rem;
  --fs-lg: 1.2rem;
  --fs-xl: 1.4rem;

  /* Common */
  --radius: 0.5em;
  --transition: 0.15s ease;
  --shadow: 0 2px 4px var(--shadow-color);
}

  /* Dark mode */
  [data-theme="dark"] {
    --bg: #1A1A1A;
    --white: #2B2B2B;
    --text: #F5F5F5;
    --border: #444444;
    --muted: #888888;
    --shadow-color: rgba(0,0,0,0.8);
    --group-bg: #3C3C3C;
    --button-bg: #4D4D4D;
    --button-hover: #636363;
    --modal-bg: rgba(0,0,0,0.85);
  }

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

body {
  font: var(--fs-base)/1.4 var(--font);
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

body.modal-open {
    overflow: hidden;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar-left {
  background: var(--white);
  padding: var(--md);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  width: 220px;
  box-shadow: var(--shadow);
}
.sidebar-right {
    background: var(--white);
    padding: var(--md);
    display: flex;
    flex-direction: column;
    width: 220px;
    box-shadow: var(--shadow);
}
.total-breakdown-container {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: var(--md);
}

.content-area {
  flex: 1;
  padding: var(--md);
  background: var(--bg);
  overflow-y: auto;
}

/* Search bar */
.search-container {
  position: relative;
  margin-bottom: var(--md);
}

#categorySearch {
  width: 100%;
  padding: var(--sm) var(--md);
  padding-right: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--text);
  font-size: var(--fs-sm);
}

#categorySearch:focus {
  outline: none;
  border-color: var(--print-color);
}

#clearSearchBtn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-base);
  display: none;
}


/* Category groups */
.category-group {
  margin-bottom: var(--sm);
}

.category-group-title {
  font-size: var(--fs-xs);
  font-weight: bold;
  text-transform: uppercase;
  color: var(--muted);
  padding: var(--xs) var(--sm);
  background: var(--group-bg);
  border-radius: var(--radius);
  margin-bottom: var(--xs);
}

/* Category buttons */
.category-buttons {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--md);
  padding-right: var(--sm);
}

.category-button {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--sm);
  margin-bottom: var(--xs);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-sm);
  color: var(--text);
}

.category-button:hover {
  transform: translateY(-1px);
  color: white;
  background: var(--category-color);
  box-shadow: var(--shadow);
}

.category-button i {
  margin-right: var(--sm);
  font-size: var(--fs-base);
}

.job-count {
  margin-left: auto;
  padding: 1px 5px;
  background: var(--muted);
  color: white;
  border-radius: var(--radius);
  font-size: var(--fs-xs);
  font-weight: bold;
}

.job-count.active {
  background: var(--category-color);
  color: white;
}

/* Job cards - Masonry Layout */
.job-list {
  column-count: auto;
  column-width: 220px;
  column-gap: var(--md);
}

.job {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--category-color);
  border-radius: var(--radius);
  padding: var(--md);
  margin-bottom: var(--md);
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  transition: box-shadow var(--transition), transform 0.3s ease; /* SMOOTH DND */
  animation: fadeInScale 0.2s ease;
  box-shadow: 0 1px 3px var(--shadow-color);
}
/* REMOVED .job:hover */

/* Drag and Drop styles */
.job.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}
.drag-handle {
    cursor: grab;
    color: var(--muted);
    padding: var(--xs) var(--sm);
    margin-right: var(--sm);
    font-size: var(--fs-lg);
    transition: color var(--transition);
}
.drag-handle:hover {
    color: var(--text);
}
.drag-handle:active {
    cursor: grabbing;
}


.imposed-job .switch-group input:disabled + label {
    opacity: 1;
    cursor: default;
}

.imposed-job .switch-group input:checked:disabled + label {
    background: var(--category-color) !important;
    color: white !important;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
}


@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.job-header {
  display: flex;
  align-items: center;
  gap: var(--xs);
  margin-bottom: var(--sm);
}

.job-title {
  flex: 1;
  margin-right: var(--xs);
}

.job-title input {
  width: 100%;
  border: none;
  background: none;
  font-weight: bold;
  font-size: var(--fs-sm);
  color: var(--text);
}

.job-title input::placeholder {
  color: var(--muted);
}

.job-title input:focus {
  outline: none;
  border-bottom: 1px solid currentColor;
}

.job-actions {
  display: flex;
  gap: 2px;
}

.job-actions button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-base);
  padding: var(--xs);
  transition: color var(--transition);
}

.job-actions button:hover {
  color: var(--category-color);
}

/* Multiplier section */
.job-multiplier-section {
  display: flex;
  align-items: center;
  gap: var(--xs);
  margin-top: var(--sm);
  padding-top: var(--sm);
  border-top: 1px dashed var(--border);
}

.job-multiplier-label {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  font-weight: bold;
}

.job-multiplier-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.job-multiplier-input {
  width: 45px;
  padding: 3px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--white);
}

.job-multiplier-controls button {
  width: 22px;
  height: 22px;
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-xs);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.job-multiplier-controls button:hover {
  background: var(--category-color);
  color: white;
  border-color: var(--category-color);
}

/* Form controls */
.job-controls label {
  display: block;
  font-weight: bold;
  font-size: var(--fs-xs);
  margin-top: var(--sm);
  margin-bottom: var(--xs);
  text-transform: uppercase;
  color: var(--muted);
}

.job-controls .control-sub-group {
    padding-left: var(--md);
    margin-top: var(--sm);
    border-left: 2px solid var(--border);
}

.job-controls .control-sub-group-title {
    font-size: var(--fs-xs);
    color: var(--muted);
    font-weight: bold;
    margin-bottom: var(--xs);
}

.switch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: var(--sm);
}

.switch-group input[type="radio"] {
  display: none;
}

.switch-group input[type="radio"]:disabled + label {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--button-bg);
    color: var(--muted);
    transform: none;
    text-shadow: none;
}

.switch-group label {
  flex: 1 0 30%;
  padding: var(--xs) var(--sm);
  text-align: center;
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-xs);
  color: var(--text);
}

.switch-group label:hover {
  transform: translateY(-1px);
  background: var(--button-hover);
}

.switch-group input:checked + label {
  background: var(--category-color);
  color: white;
  text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* Quick buttons */
.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: var(--xs);
}

.quick-buttons button {
  flex: 1 0 18%;
  padding: var(--xs);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--fs-xs);
  color: var(--text);
  transition: all var(--transition);
}

.quick-buttons button:hover,
.quick-buttons button.active {
  background: var(--category-color);
  color: white;
  transform: translateY(-1px);
  text-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* NEW: Quick Format Buttons */
.quick-format-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: var(--sm);
}

.quick-format-buttons button {
    flex: 1 1 auto;
    padding: var(--xs) var(--sm);
    font-size: var(--fs-xs);
    background: var(--button-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
}

.quick-format-buttons button.active,
.quick-format-buttons button:hover {
    background: var(--category-color);
    color: white;
    transform: translateY(-1px);
}


.quantity-input {
  display: flex;
  align-items: center;
  gap: 2px;
}
.quantity-input input:disabled,
.quantity-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--button-bg);
}

.quantity-input input {
  flex: 1;
  padding: var(--xs) var(--sm);
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: monospace;
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--white);
}

.quantity-input button {
  width: 26px;
  height: 26px;
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-sm);
  color: var(--text);
}

.quantity-input button:hover {
  background: var(--category-color);
  color: white;
  border-color: var(--category-color);
}

.job-total-price {
  margin-top: var(--sm);
  padding-top: var(--xs);
  text-align: center;
  font-weight: bold;
  color: var(--muted);
  text-transform: uppercase;
  font-size: var(--fs-sm);
}

/* Other inputs */
input[type="text"] {
  width: 100%;
  padding: var(--xs) var(--sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--white);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--category-color);
}
input[type="text"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--button-bg);
}

.input-error {
  border-color: #dc3545 !important;
  animation: shake 0.4s;
}

.job.job-error::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--error);
  pointer-events: none;
}

/* IMPOSE BUTTON */
.impose-button-wrapper {
    display: flex;
    width: 100%;
    gap: 2px;
    margin-top: var(--sm);
}
.impose-button-wrapper .remove-impose {
    flex: 0 0 30px;
    background: var(--button-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    cursor: pointer;
    transition: all var(--transition);
    font-size: var(--fs-sm);
}
.impose-button-wrapper .remove-impose:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}
.impose-job {
    width: 100%;
    padding: var(--sm);
    margin-top: var(--sm);
    border: 1px solid var(--border);
    background: var(--button-bg);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: bold;
}
.impose-button-wrapper .impose-job {
    flex: 1;
    margin-top: 0;
}
.impose-job:hover {
    background: var(--category-color);
    color: white;
    transform: translateY(-1px);
}
.impose-job.active {
    background: var(--category-color);
    color: white;
    font-weight: bold;
}
.impose-job.active::before {
    content: '\f00c\00a0'; /* Check icon */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

/* Sidebar actions */
.sidebar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--xs);
  padding-top: var(--sm);
  border-top: 1px solid var(--border);
}

.sidebar-action-button {
  flex: 1 0 45%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--xs);
  padding: var(--sm);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-xs);
  color: var(--text);
}

.sidebar-action-button:hover {
  background: var(--text);
  color: var(--white);
  transform: translateY(-1px);
}

/* Theme toggle */
.theme-toggle {
  flex: 1 0 100%;
  margin-top: var(--xs);
}

.theme-toggle-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--xs);
  padding: var(--sm);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-xs);
  color: var(--text);
}

.theme-toggle-button:hover {
  background: var(--text);
  color: var(--white);
  transform: translateY(-1px);
}


/* Bill section */
.bill-info {
  margin-bottom: var(--md);
}

.bill-info input {
  width: 100%;
  padding: var(--sm);
  margin-bottom: var(--xs);
  font-size: var(--fs-base);
  font-weight: bold;
  border: none;
  border-bottom: 1px solid var(--muted);
  color: var(--text);
  background: transparent;
}

.bill-info input:focus {
  outline: none;
  border-bottom-color: var(--text);
}

.bill-info input:last-child {
  font-size: var(--fs-sm);
  font-weight: normal;
}

.total-price {
  font-size: var(--fs-lg);
  font-weight: bold;
  text-align: center;
  margin-bottom: var(--md);
  color: var(--text);
}

.total-amount {
  display: block;
  font-size: var(--fs-xl);
  margin-top: var(--xs);
}

.dashed-line {
  border: none;
  border-top: 2px dashed var(--border);
  margin: var(--md) 0;
}

.total-breakdown {
  font-size: var(--fs-xs);
  color: var(--text);
}

.total-breakdown-item {
  margin-bottom: var(--sm);
  padding-bottom: var(--xs);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.total-breakdown-item:last-child {
  border-bottom: none;
}

.total-breakdown-item span {
  display: block;
  line-height: 1.4;
  margin-bottom: 2px;
}

.total-breakdown-item .bullet {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: var(--xs);
  vertical-align: middle;
}

.remove-from-bill {
  position: absolute;
  right: 0;
  top: 0;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: var(--xs);
  font-size: var(--fs-sm);
  transition: color var(--transition);
}

.remove-from-bill:hover {
  color: #dc3545;
}

/* Sidebar Right Actions Container */
.sidebar-right-actions {
  display: flex;
  flex-direction: column;
  gap: var(--xs);
  margin-top: auto;
  padding-top: var(--sm);
}

.save-bill-button, .generate-invoice-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--xs);
  padding: var(--sm);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-xs);
  color: var(--text);
}

.save-bill-button {
    margin-top: 0;
}

.save-bill-button:hover, .generate-invoice-button:hover {
  background: var(--text);
  color: var(--white);
  transform: translateY(-1px);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--white);
  margin: 10vh auto;
  padding: var(--lg);
  width: 90%;
  max-width: 400px;
  border-radius: 8px;
  color: var(--text);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  border: 1px solid var(--border);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--md);
}

.modal-header h3 {
  font-size: var(--fs-lg);
  color: var(--text);
}

.modal-icon {
  width: 60px;
  height: 60px;
  background: #dc3545;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--md);
  color: white;
  font-size: 24px;
}
 #removeImposeModal .modal-icon {
    background-color: #ffc107;
 }

.modal-body {
  text-align: center;
  margin-bottom: var(--lg);
  color: var(--muted);
  font-size: var(--fs-base);
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}

.close-button:hover {
  background: var(--button-bg);
  color: var(--text);
}

.modal-actions {
  display: flex;
  gap: var(--sm);
  margin-top: var(--lg);
}

.confirm-button,
.cancel-button {
  flex: 1;
  padding: var(--sm) var(--md);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-sm);
  font-weight: bold;
}

.confirm-button {
  background: #dc3545;
  color: white;
}

.modal-actions .confirm-button-green {
  background-color: var(--category-color, #28a745);
}
.modal-actions .confirm-button-green:hover {
  filter: brightness(0.9);
}

.cancel-button {
  background: var(--button-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.confirm-button:hover {
  background: #b02a37;
  transform: translateY(-1px);
}

.cancel-button:hover {
  background: var(--button-hover);
  transform: translateY(-1px);
}

/* Size popup */
#sizePopup .modal-content, #imposeSizePopup .modal-content {
    max-width: 800px;
}

.size-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--md);
  margin-top: var(--md);
}

.size-buttons > div h5 {
  margin-bottom: var(--xs);
  font-size: var(--fs-sm);
  color: var(--text);
  text-align: center;
  padding-bottom: var(--xs);
  border-bottom: 1px solid var(--border);
}

.size-buttons button {
  width: 100%;
  padding: var(--sm);
  margin-bottom: 2px;
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-xs);
  color: var(--text);
}

.size-buttons button:hover,
.size-buttons button.active {
  background: var(--popup-category-color);
  color: white;
  transform: translateY(-1px);
  border-color: var(--popup-category-color);
}


.select-size-button {
  width: 100%;
  padding: var(--sm);
  margin-top: var(--sm);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: var(--fs-sm);
  font-weight: bold;
  color: var(--text);
}

.select-size-button:hover {
  background: var(--category-color);
  color: white;
  transform: translateY(-1px);
}

/* IMPOSE MODAL STYLES */
#imposePopup .modal-content {
    max-width: 95vw;
    width: 95vw;
    height: 90vh;
    margin: 5vh auto;
    display: flex;
    flex-direction: column;
    padding: 0;
}

#imposePopup .modal-header {
    padding: var(--md);
    padding-bottom: var(--md);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#imposePopup .modal-actions {
    padding: var(--md);
    padding-top: var(--md);
    margin-top: 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.impose-container {
    display: flex;
    gap: var(--lg);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--md);
}

.impose-controls {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--sm);
    padding-right: var(--sm);
}
.quantity-input-wrapper {
    margin-bottom: var(--md);
}
.impose-controls .quantity-input input {
    font-size: 1.0rem;
    padding: 0.5rem;
}
.impose-controls .quantity-input button {
    width: 40px;
    height: 40px;
    font-size: 1.0rem;
}
.impose-controls .quantity-input-wrapper.input-error {
    animation: shake 0.4s;
}
.impose-controls .quantity-input-wrapper.input-error .quantity-input input,
.impose-controls .quantity-input-wrapper.input-error .quantity-input button {
     border-color: #dc3545;
}

.impose-controls-group {
    background: var(--group-bg);
    padding: var(--md);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.impose-controls-group h5 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--sm) 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--xs);
}

.impose-input-row {
  display: flex;
  gap: var(--sm);
  align-items: flex-start;
}
.impose-input-row > div {
  flex: 1 1 0;
}

#imposePaperSizeContainer .switch-group label,
#imposeA3SubtypeContainer .switch-group label {
    padding: var(--md);
    font-size: var(--fs-base);
    font-weight: normal;
    flex-basis: 10%;
}

.impose-controls .switch-group label {
    flex-basis: 10%;
    padding: var(--sm);
    font-size: var(--fs-sm);
}

.impose-preview-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--md);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.impose-paper-container .paper-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    color: var(--text);
    padding: var(--lg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    z-index: 10;
}
.paper-warning span, .paper-warning button {
    font-weight: bold;
    color: var(--category-color);
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    font-size: inherit;
    padding: 0.2rem;
}
.paper-warning button {
    background: var(--category-color);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
    display: inline-block;
}
[data-theme="dark"] .impose-paper-container .paper-warning {
    background: var(--bg);
    border-color: var(--border);
}


.impose-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--sm);
    padding: var(--sm);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--md);
    font-size: var(--fs-xs);
    text-align: center;
    flex-shrink: 0;
}

.impose-results div {
  padding: var(--xs);
}
.impose-results .result-label {
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}
.impose-results .result-value {
  font-weight: bold;
  font-size: var(--fs-base);
  color: var(--text);
}
.impose-results .result-value.highlight {
  color: var(--category-color);
  font-size: var(--fs-lg);
}

.impose-paper-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

#impose-paper-preview {
    background: rgba(255, 255, 255, 0);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    border: 1px solid #ccc;
    max-width: 100%;
    max-height: 100%;
    flex-shrink: 0;
}
#impose-paper-preview.doublesided-color {
    box-shadow: 0 0 0 4px var(--category-color);
}
#impose-paper-preview.doublesided-bw {
    box-shadow: 0 0 0 4px var(--muted);
}

.impose-item-preview {
    position: absolute;
    box-shadow: inset 0 0 0 100vw var(--category-color);
    outline: 1px solid var(--border);
}
 .impose-item-preview.bw {
    box-shadow: inset 0 0 0 100vw #aaa;
}
.impose-render-warning {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    color: var(--muted);
    background-color: var(--button-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}
.impose-render-warning::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    content: "\f06e";
    font-size: 32px;
    margin-bottom: 15px;
    color: var(--category-color);
}

/* Slider */
.job-hours-slider, .job-cuts-slider {
  width: 100%;
  margin-top: var(--sm);
}

.slider-value {
  text-align: center;
  font-weight: bold;
  margin-top: var(--xs);
  font-size: var(--fs-sm);
  color: var(--text);
}

/* Animations */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

.job-remove-animation {
  animation: fadeOut 0.15s ease forwards;
}

.job-duplicate-animation {
  animation: fadeInScale 0.2s ease;
}

.price-update-animation {
  animation: shake 0.2s;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: var(--radius);
}

::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: var(--radius);
}

/* RESPONSIVE FIXES */
@media (max-width: 1200px) {
    .impose-container {
        flex-direction: column;
    }
    .impose-controls {
        flex: 0 1 auto;
        width: 100%;
        padding-right: 0;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        justify-content: normal;
    }
    .impose-preview-area {
        min-height: 40vh;
    }
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: auto;
    }

    .sidebar-left,
    .sidebar-right,
    .content-area {
        width: 100%;
        height: auto;
        max-height: none;
    }

    .sidebar-left {
        max-height: 50vh;
    }

    .job-list {
        column-count: 1;
    }

    /* Bigger touch targets */
    input,
    .quantity-input input {
        font-size: 1rem;
        padding: var(--md);
    }
    .quantity-input button {
        width: 40px;
        height: 40px;
    }
     .sidebar-action-button, .theme-toggle-button, .save-bill-button, .generate-invoice-button {
        padding: var(--md);
        font-size: var(--fs-sm);
    }

    .modal-content {
        width: 95%;
        margin: 2.5vh auto;
    }
    #imposePopup .modal-content {
        height: auto;
        max-height: 95vh;
    }

    #sizePopup .modal-content .size-buttons,
    #imposeSizePopup .modal-content .size-buttons {
        grid-template-columns: 1fr;
    }
    
    .impose-controls {
        grid-template-columns: 1fr;
    }

    .impose-controls .switch-group label {
        flex-basis: 48%; /* Make buttons mostly full-width but allow two per row */
    }

    .impose-preview-area {
        min-height: 55vh;
    }

    .impose-results {
        grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
        gap: var(--xs);
        padding: var(--sm);
    }
    .impose-results .result-label {
        font-size: 0.65rem;
    }
    .impose-results .result-value {
        font-size: var(--fs-sm);
    }
    .impose-results .result-value.highlight {
        font-size: var(--fs-base);
    }
    .impose-input-row {
        flex-direction: column;
        gap: 0;
    }
    
    /* Invoice Popup Responsive */
    .invoice-form .form-grid {
      grid-template-columns: 1fr;
    }
    .invoice-form .form-grid .form-row,
    .invoice-form .form-grid .form-group.span-2 {
      grid-column: 1 / -1;
    }
    .form-row.single-row {
      display: flex;
      flex-direction: column;
      gap: var(--md);
    }
    .form-row.single-row > * {
      width: 100%;
    }
}

/* Invoice Popup Styles */
#invoicePopup .modal-content {
  max-width: 800px;
}

#invoicePopup .modal-body {
  text-align: left;
  max-height: 70vh;
  overflow-y: auto;
  padding: 5px 20px 20px 20px;
}

.invoice-form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--md);
  margin-top: var(--md);
}

.invoice-form .form-group {
  display: flex;
  flex-direction: column;
}

.form-group.span-2 {
    grid-column: span 2;
}

.form-row {
    grid-column: span 2;
    display: flex;
    gap: var(--md);
}
.form-row .form-group {
    flex: 1;
}

.invoice-form label {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: var(--xs);
  font-weight: bold;
}

.invoice-form input,
.invoice-form select {
  width: 100%;
  padding: var(--md);
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
}

.invoice-form input:focus,
.invoice-form select:focus {
    outline: 1px solid var(--category-color, var(--print-color));
}

.invoice-summary {
    margin-top: var(--lg);
    border-top: 1px solid var(--border);
    padding-top: var(--md);
}

.invoice-summary h4 {
    font-size: var(--fs-base);
    color: var(--text);
    margin-bottom: var(--sm);
}

.invoice-items-preview-container {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--sm);
    text-align: center;
}

#invoiceItemsPreview {
    width: 100%;
    border-collapse: collapse;
    margin: 0 auto;
    text-align: left;
}

#invoiceItemsPreview th,
#invoiceItemsPreview td {
    padding: var(--xs) var(--sm);
    text-align: left;
    font-size: var(--fs-sm);
}

#invoiceItemsPreview thead {
    position: sticky;
    top: 0;
    background-color: var(--group-bg);
}

#invoiceItemsPreview tbody tr:nth-child(even) {
    background-color: var(--group-bg);
}

.invoice-total-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sm);
    background-color: var(--group-bg);
    border-radius: var(--radius);
    margin-top: var(--md);
}

.invoice-total-preview span {
    font-weight: bold;
    color: var(--muted);
}

.invoice-total-preview strong {
    font-size: var(--fs-lg);
    color: var(--text);
}

.text-right {
    text-align: right !important;
}

.input-with-stepper {
  display: flex;
  align-items: center;
}

.input-with-stepper input {
  text-align: center;
  border-left: none;
  border-right: none;
  border-radius: 0;
  z-index: 1;
}

.input-with-stepper input:focus {
  z-index: 2;
}

.stepper-btn {
  width: 40px;
  height: 40px;
  background-color: var(--button-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: var(--fs-lg);
  color: var(--text);
  transition: background-color var(--transition);
  z-index: 1;
}

.stepper-btn:hover {
  background-color: var(--button-hover);
}

.stepper-decrement {
  border-radius: var(--radius) 0 0 var(--radius);
}

.stepper-increment {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.fiskalni-group {
  display: flex;
  align-items: center;
  gap: var(--xs);
}

.fiskalni-group span {
  font-size: var(--fs-lg);
  color: var(--muted);
}

.fiskalni-group .input-with-stepper {
  flex: 1;
}

.form-row.single-row {
    grid-column: span 1;
    flex-direction: row;
}

.invoice-form .input-error {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 1px #dc3545;
  animation: shake 0.4s;
}

.invoice-form .input-error:focus {
    outline-color: #dc3545 !important;
}

/* Smooth Drag & Drop Placeholder */
.drop-placeholder {
  background: var(--button-hover);
  border: 2px dashed var(--category-color, var(--print-color));
  border-radius: var(--radius);
  margin-bottom: var(--md);
  height: 50px; /* Visina placeholdera */
  transition: height 0.2s ease;
}