/* =====================================================
   BASE (ΑΣΦΑΛΕΣ/ΟΥΔΕΤΕΡΟ) – ισχύει παντού, δεν “πειράζει” άλλα grids
   ===================================================== */

.custom_table{
  position:relative; padding:20px; max-width:960px; width:100%!important;
  background:var(--boxbg); margin:20px auto!important; border-radius:8px;
  box-shadow:0 2px 8px rgba(0,0,0,.12); border-bottom:0 solid transparent!important;
  font-size:13px; text-align:left;
}
.custom_table_title{ padding:10px 5px; font-size:18px; font-weight:700; text-align:center; }

.custom_table_pre_header{ position:relative; overflow:hidden; }
.custom_table_page_length_box{ float:left; display:flex; align-items:center; gap:8px; }
.custom_table_page_length{
  padding:6px 12px; font-size:14px; color:#555; background:#fff; border:1px solid #ccc; border-radius:4px; float:left;
}

@media (max-width:905px){ .custom_table_button_text{ display:none; } }

.custom_table_top_buttons{ float:right; }
.custom_table_top_button{ float:right; margin-left:4px; }
.custom_table_top_button_selected{ background:orange!important; }
.custom_table_top_button_bulk_delete{
  display:none; align-items:center; justify-content:center;
  min-width:40px; width:40px; padding:0; transition:background-color .16s ease, border-color .16s ease, opacity .16s ease;
}
.custom_table_top_button_bulk_delete.has-selection{ display:inline-flex; }

/* Header */
.custom_table_header{ position:relative; overflow:hidden; white-space:nowrap; }
.custom_table_header_column{
  display:inline-block; font-weight:700; text-align:center; padding:6px 8px;
  white-space:nowrap; text-overflow:ellipsis; overflow:hidden; cursor:pointer;
}
.custom_table_header .sorted_asc{ background:url(../images/sort_asc.png) no-repeat right center; }
.custom_table_header .sorted_desc{ background:url(../images/sort_desc.png) no-repeat right center; }

/* Data container / zebra / hover */
.custom_table_data{ position:relative; overflow:hidden; }
.custom_table_data .row_selected{ background:var(--row_selected)!important; }
.custom_table_data_row{ height:50px; white-space:nowrap; user-select:none; }
.custom_table_data_row:nth-child(odd){ background:#f9f9f9; }
.custom_table_data_row:nth-child(even){ background:#fff; }
.custom_table_data_row:hover{ background:#f5f6f8; }

/* Data cell */
.custom_table_data_column{
  display:inline-block; height:100%; padding:12px 10px; text-align:left;
  white-space:nowrap; text-overflow:ellipsis; overflow:hidden;
  border-left:1px solid #D7DBE0; border-bottom:1px solid #D7DBE0;
}
.custom_table_data_row:first-child .custom_table_data_column{ border-top:1px solid #D7DBE0; }
.custom_table_data_column:first-child{ border-left:1px solid #D7DBE0; border-top-left-radius:10px; border-bottom-left-radius:10px; }
.custom_table_data_column:last-child{ border-right:1px solid #D7DBE0; border-top-right-radius:10px; border-bottom-right-radius:10px; }

.custom_table_data_row .custom_table_data_actions{ padding:7px 5px 5px 5px; }
.custom_table_data_column_check, .custom_table_data_column_number{ text-align:center; }
.custom_table_header_column_select,
.custom_table_search_column_select,
.custom_table_data_column_select{
  display:inline-flex!important; align-items:center; justify-content:center; padding-left:0!important; padding-right:0!important; vertical-align:top;
}

.custom_table_checkbox{
  position:relative; display:inline-flex; align-items:center; justify-content:center; cursor:pointer; margin:0;
}
.custom_table_checkbox input{
  position:absolute; inset:0; opacity:0; margin:0; cursor:pointer;
}
.custom_table_checkbox_box{
  width:20px; height:20px; border-radius:7px; border:1px solid #c7d2e8; background:#fff;
  display:inline-flex; align-items:center; justify-content:center; transition:all .16s ease;
}
.custom_table_checkbox_box .custom_table_icon_check{ opacity:0; transform:scale(.7); }
.custom_table_checkbox input:checked + .custom_table_checkbox_box{
  background:#5f6dff; border-color:#5f6dff; box-shadow:0 10px 20px rgba(95, 109, 255, .18);
}
.custom_table_checkbox input:checked + .custom_table_checkbox_box .custom_table_icon_check{
  opacity:1; transform:scale(1);
}

/* Search row */
.custom_table_search_row{ position:relative; overflow:hidden; white-space:nowrap; }
.custom_table_search_column{ display:inline-block; text-align:left; padding:6px 8px; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
.custom_table_search_column input{ width:100%; }
.custom_table_search_column button{ width:100%; height:24px; font-size:10px; border:1px solid #EEE; }

/* Footer */
.custom_table_footer{ position:relative; padding-top:5px; overflow:hidden; border-top:1px solid #888; }
.custom_table_footer_export_buttons{ float:left; }
.custom_table_footer_export_button{ margin-right:10px; }
.custom_table_footer_pagination{ float:right; }
.custom_table_footer_pagination_button{ margin-left:10px; }

.center-text{ text-align:center; }

.custom_table_icon{ position:relative; display:inline-block; }
.custom_table_icon_check{ width:10px; height:6px; border-left:2px solid #fff; border-bottom:2px solid #fff; transform:rotate(-45deg); }
.custom_table_icon_trash{
  width:14px; height:14px; color:currentColor;
}
.custom_table_icon_trash::before{
  content:""; position:absolute; left:3px; top:4px; width:8px; height:8px; border:2px solid currentColor; border-top:0; border-radius:0 0 2px 2px;
}
.custom_table_icon_trash::after{
  content:""; position:absolute; left:2px; top:1px; width:10px; height:2px; background:currentColor; border-radius:2px;
  box-shadow:3px -2px 0 -1px currentColor;
}

/* Φιλική εμφάνιση φίλτρων (ουδέτερη) */
.custom_table_search_column input,
.custom_table_search_column select,
.custom_table_search_column button{
  height:34px!important; padding:5px 10px!important; border-radius:8px!important;
  background:#F3F4F6!important; border:1px solid #D7DBE0!important; width:100%!important; box-sizing:border-box!important;
}

/* Να μην “σκοτώνονται” από fixed table-layout σε άλλα θέματα */
.custom_table_table, #custom_table_div table{ table-layout:auto!important; }

/* Οριζόντιο scroll όταν στριμώξει (γενικό, ακίνδυνο) */
#custom_table_div{ overflow-x:auto; -webkit-overflow-scrolling:touch; }

/* =====================================================
   COMPACT/STICKY/RADIUS/WRAP — ΜΟΝΟ όπου ο wrapper έχει .ct-compact
   ===================================================== */

/* μικρότερη γραμματοσειρά & padding */
.ct-compact .custom_table_header,
.ct-compact .custom_table_search_row,
.ct-compact .custom_table_data_row{ font-size:14px!important; }
.ct-compact .custom_table_header_column,
.ct-compact .custom_table_search_column,
.ct-compact .custom_table_data_column{
  padding:6px 8px!important; line-height:1.25!important; vertical-align:middle!important;
}

/* Ημερομηνία (2η στήλη): wrap σε 2 γραμμές (ημερομηνία / ώρα) & στενό πλάτος */
.ct-compact .custom_table_header .custom_table_header_column:nth-child(2),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(2),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(2){
  min-width:90px!important; max-width:100px!important;
  white-space:normal!important; word-break:keep-all!important; overflow-wrap:anywhere!important;
  text-align:left!important; line-height:1.15!important; text-overflow:clip!important;
}

/* ΡΗΤΑ μικρά πλάτη για να χωράνε όλα (960px) */
.ct-compact .custom_table_header .custom_table_header_column:nth-child(1),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(1),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(1){ width:80px!important; text-align:center!important; white-space:nowrap!important; } /* Id */

.ct-compact .custom_table_header .custom_table_header_column:nth-child(3),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(3),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(3){ width:70px!important; text-align:center!important; white-space:nowrap!important; } /* Order Id */

.ct-compact .custom_table_header .custom_table_header_column:nth-child(4),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(4),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(4){ width:64px!important; max-width:80px!important; text-align:center!important; } /* Τραπέζι */

.ct-compact .custom_table_header .custom_table_header_column:nth-child(5),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(5),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(5){ min-width:150px!important; white-space:normal!important; } /* Πελάτης */

.ct-compact .custom_table_header .custom_table_header_column:nth-child(6),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(6),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(6){ min-width:120px!important; white-space:normal!important; } /* Κάτοχος */

.ct-compact .custom_table_header .custom_table_header_column:nth-child(7),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(7),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(7){ min-width:80px!important; white-space:normal!important; } /* Τύπος */

.ct-compact .custom_table_header .custom_table_header_column:nth-child(8),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(8),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(8){ width:80px!important; text-align:right!important; white-space:nowrap!important; } /* Ποσό */

.ct-compact .custom_table_header .custom_table_header_column:nth-child(9),
.ct-compact .custom_table_search_row .custom_table_search_column:nth-child(9),
.ct-compact .custom_table_data_row .custom_table_data_column:nth-child(9){ width:56px!important; text-align:center!important; white-space:nowrap!important; } /* Ολοκλ. */

/* Actions: sticky δεξιά + compact κουμπιά */
.ct-compact .custom_table_header .custom_table_header_column:last-child,
.ct-compact .custom_table_search_row .custom_table_search_column:last-child,
.ct-compact .custom_table_data_row .custom_table_data_column:last-child{
  position:sticky!important; right:0!important; z-index:3!important; background:#fff!important;
  width:104px!important; min-width:104px!important; text-align:right!important;
  border-left:1px solid #D7DBE0!important; border-top-right-radius:8px!important; border-bottom-right-radius:8px!important;
  white-space:nowrap!important;
}

/* ΜΟΝΟ για compact πίνακες */
.ct-compact .custom_table_search_row input::placeholder { 
  color: transparent !important;    /* δεν φαίνεται το placeholder */
}

/* CT-COMPACT: κρύψε τα βελάκια από τα number filters */
.ct-compact .custom_table_search_row input[type="number"] {
  -moz-appearance: textfield;   /* Firefox */
  appearance: textfield;        /* νεότερα browsers */
}

/* Chrome / Edge / Safari (WebKit) */
.ct-compact .custom_table_search_row input[type="number"]::-webkit-outer-spin-button,
.ct-compact .custom_table_search_row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}



.ct-compact .custom_table_data_actions .btn,
.ct-compact .custom_table_data_column:last-child .btn{
  min-width:28px!important; height:28px!important; padding:0 8px!important; margin-left:6px!important; border-radius:9999px!important;
}
.ct-compact .custom_table_data_actions .btn:first-child,
.ct-compact .custom_table_data_column:last-child .btn:first-child{ margin-left:0!important; }

/* χρώματα κουμπιών (μόνο στο compact) */
.ct-compact .custom_table_data_actions .btn-edit,
.ct-compact .custom_table_data_column:last-child .btn-edit,
.ct-compact .custom_table_data_actions .btn-primary,
.ct-compact .custom_table_data_column:last-child .btn-primary{ background:#111!important; color:#fff!important; border:0!important; }
.ct-compact .custom_table_data_actions .btn-delete,
.ct-compact .custom_table_data_column:last-child .btn-delete,
.ct-compact .custom_table_data_actions .btn-danger,
.ct-compact .custom_table_data_column:last-child .btn-danger{ background:#e11d48!important; color:#fff!important; border:0!important; }

/* μικρότερο gap ανάμεσα στα pills στο compact */
.ct-compact .custom_table_data_row{ margin:4px 0!important; }

  /* Οριζόντια κύλιση μόνο για τον πίνακα */
  .scroll-x-wrapper{
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    background: #fff;      /* ενιαίο φόντο στο κινητό */
    padding-bottom: 2px;   /* να μην ακουμπά το scrollbar */
  }

  /* Desktop/Large: γεμίζει 100% όπως πριν */
  .scroll-x-wrapper > *{
    width: 100%;
    min-width: 0;
  }
  .scroll-x-wrapper th,
  .scroll-x-wrapper td{
    white-space: normal;
  }

  /* Σε μικρές οθόνες κρατά “desktop” πλάτος και εμφανίζει οριζόντιο scroll */
  @media (max-width: 992px){
    .scroll-x-wrapper > *{
      width: max-content;   /* όσο χρειάζεται */
      min-width: 1200px;    /* αύξησέ το αν θες (π.χ. 1400) */
    }
    .scroll-x-wrapper th,
    .scroll-x-wrapper td{
      white-space: nowrap;
    }
  }

  /* Προαιρετικά: πιο εμφανές scrollbar */
  .scroll-x-wrapper::-webkit-scrollbar{ height: 8px; }
  .scroll-x-wrapper::-webkit-scrollbar-thumb{ background: #bbb; border-radius: 4px; }

  /* ===== Edit pages: κάνε το <form> να είναι “card” ===== */
.app-page-content form{
  max-width: 1100px;         /* ίδιο πλάτος με τα lists */
  margin: 20px auto;         /* κεντράρισμα */
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
  padding: 22px;
}

/* Τίτλος μέσα στο card */
.app-page-content form h1,
.app-page-content form h2,
.app-page-content form .page-title{
  margin: 0 0 16px;
}

/* Inputs/Selects/Textareas – στρογγυλά, καθαρά borders */
.app-page-content form input[type="text"],
.app-page-content form input[type="number"],
.app-page-content form input[type="email"],
.app-page-content form input[type="tel"],
.app-page-content form input[type="password"],
.app-page-content form input[type="date"],
.app-page-content form input[type="datetime-local"],
.app-page-content form select,
.app-page-content form textarea {
  height: 38px;
  padding: 6px 10px;
  border: 1px solid #D7DBE0;
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.02);
  outline: 0;
}

.app-page-content form textarea{
  min-height: 120px;           /* για μεγάλα κείμενα */
  resize: vertical;
}

.app-page-content form input:focus,
.app-page-content form select:focus,
.app-page-content form textarea:focus {
  border-color: #111827;
  box-shadow: 0 0 0 3px rgba(17,24,39,.12);
}

/* Buttons – μαύρο primary & κόκκινο danger, στρογγυλά */
.app-page-content form .btn,
.app-page-content form button[type="submit"],
.app-page-content form input[type="submit"]{
  border-radius: 9999px !important;
  height: 36px;
  padding: 0 14px;
  border: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.10);
}

.app-page-content form .btn-primary,
.app-page-content form button[type="submit"].btn-primary{
  background: #111; color:#fff;
}

.app-page-content form .btn-danger{
  background:#e11d48; color:#fff;
}

/* Μικρο-βελτιώσεις πλέγματος/πεδίων */
.app-page-content form .form-group,
.app-page-content form .row > [class*="col-"]{
  margin-bottom: 12px;
}

/* Tables/embedded lists μέσα στο form να κουμπώνουν σωστά */
.app-page-content form table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
}




/* =====================================================
   MODAL
   ===================================================== */
#modal_custom_table{ display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,.5); }
#modal_custom_table_container{ position:relative; width:100%; max-width:960px; margin-top:30px; }
#modal_custom_table_box{
  width:100%; padding:20px; background:#F7F7F7; margin:20px auto!important; border-radius:8px;
  box-shadow:0 2px 8px rgba(0,0,0,.3); border-bottom:0 solid transparent!important; text-align:left;
}
#modal_custom_table_title{ font-size:20px; text-align:center; }
#modal_custom_table .custom_table{ margin-top:0!important; }
#modal_custom_table .custom_table_data_row{ cursor:pointer; }
#modal_custom_table{
  --ctm-backdrop: rgba(15, 23, 42, .58);
  --ctm-panel: linear-gradient(180deg, #1b2659 0%, #17214d 100%);
  --ctm-panel-border: #304183;
  --ctm-panel-shadow: 0 28px 60px rgba(2, 8, 23, .45);
  --ctm-card: rgba(10, 17, 44, .42);
  --ctm-card-border: rgba(160, 179, 255, .14);
  --ctm-title: #eef3ff;
  --ctm-text: #d8e2ff;
  --ctm-button-secondary-bg: rgba(20, 31, 72, .9);
  --ctm-button-secondary-border: #34488d;
  --ctm-button-secondary-text: #dce5ff;
  --ctm-checkbox-bg: #142051;
  --ctm-checkbox-border: #4a61a7;
  --ctm-checkbox-checked-bg: #5f6dff;
  --ctm-checkbox-checked-border: #5f6dff;
  inset: 0;
  z-index: 2500;
  padding: 18px 14px;
  background: var(--ctm-backdrop);
  overflow: hidden;
}
#modal_custom_table_container{
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  transform: none !important;
}
#modal_custom_table_box{
  min-height: 0;
  height: min(88vh, 860px);
  max-height: calc(100vh - 24px);
  padding: 16px;
  background: var(--ctm-panel);
  margin: 0 auto !important;
  border: 1px solid var(--ctm-panel-border);
  border-radius: 20px;
  box-shadow: var(--ctm-panel-shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: none !important;
  overflow: hidden;
}
#modal_custom_table_header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.modal_custom_table_heading{
  min-width: 0;
  flex: 1;
}
#modal_custom_table_title{
  margin: 0;
  color: var(--ctm-title);
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.03em;
  text-align: left;
}
#modal_custom_table_close{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--ctm-button-secondary-border);
  background: var(--ctm-button-secondary-bg);
  color: var(--ctm-button-secondary-text);
  font-size: 28px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .18s ease, filter .18s ease, border-color .18s ease;
}
#modal_custom_table_close:hover{
  filter: brightness(1.08);
}
#modal_custom_table_content{
  min-height: 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  transform: none !important;
}
/* Στα modals «Επιλογή παραστατικού» και «Επιλογή πελάτη» δεν εφαρμόζουμε τα παρακάτω layout */
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) #modal_custom_table_div,
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .modal_custom_table_table_container{
  width: 100%;
  min-height: 0;
  height: 100%;
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table{
  margin: 0 !important;
  max-width: none;
  width: 100% !important;
  height: 100%;
  padding: 16px;
  background: var(--ctm-card);
  border: 1px solid var(--ctm-card-border);
  border-radius: 16px;
  box-shadow: none;
  display: flex;
  flex: 1 1 0%;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#modal_custom_table .custom_table_title{
  display: none;
}
#modal_custom_table .custom_table_pre_header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
#modal_custom_table .custom_table_page_length_box,
#modal_custom_table .custom_table_top_buttons{
  float: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
#modal_custom_table .custom_table_page_length,
#modal_custom_table .custom_table_top_button,
#modal_custom_table .custom_table_top_button_clear_filters,
#modal_custom_table .custom_table_top_button_bulk_delete{
  height: 36px;
  border-radius: 12px;
  padding: 0 14px;
  border: 1px solid #41579f;
  background: rgba(19, 30, 71, .9);
  color: #e2eaff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}
#modal_custom_table .custom_table_top_button{
  background: linear-gradient(180deg, #6b63ff, #4c5af3) !important;
  border-color: #6c74ff;
  color: #fff !important;
}
#modal_custom_table .custom_table_header{
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(141, 163, 235, .22);
  border-radius: 14px 14px 0 0;
}
#modal_custom_table .custom_table_header_column{
  color: #aebce7;
  border-left-color: rgba(140, 160, 230, .14);
  font-size: 11px;
  padding-top: 8px;
  padding-bottom: 8px;
  box-sizing: border-box;
  vertical-align: top;
}
#modal_custom_table .custom_table_search_row{
  background: rgba(12, 20, 49, .56);
  border-left: 1px solid rgba(141, 163, 235, .18);
  border-right: 1px solid rgba(141, 163, 235, .18);
}
#modal_custom_table .custom_table_search_column{
  border-left-color: rgba(140, 160, 230, .14);
  box-sizing: border-box;
  vertical-align: top;
}
#modal_custom_table .custom_table_search_column input,
#modal_custom_table .custom_table_search_column select,
#modal_custom_table .custom_table_search_column button{
  height: 34px !important;
  border-radius: 10px !important;
  background: rgba(11, 17, 41, .78) !important;
  border: 1px solid rgba(122, 146, 224, .28) !important;
  color: #e8eeff !important;
  font-size: 13px !important;
}
#modal_custom_table .custom_table_search_column input::placeholder{
  color: #8fa1d5;
}
#modal_custom_table .custom_table_search_column input:focus,
#modal_custom_table .custom_table_search_column select:focus{
  outline: 0;
  box-shadow: 0 0 0 3px rgba(110, 98, 255, .18);
  border-color: #6b63ff !important;
}
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data{
  flex: 1 1 0%;
  min-height: 0;
  max-height: none;
  height: auto;
  border: 1px solid rgba(141, 163, 235, .2);
  border-top: 0;
  border-radius: 0 0 14px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) #modal_custom_table_div,
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) #modal_custom_table_div .custom_table,
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) #modal_custom_table_div .custom_table_data,
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .modal_custom_table_table_container,
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .modal_custom_table_table_container .custom_table,
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .modal_custom_table_table_container .custom_table_data{
  overflow-x: hidden !important;
}

/* Επιλογή παραστατικού: πλήρες πλάτος, γραμμές μέχρι το τέλος (override global) */
#modal_custom_table.modal-sale-series-only #modal_custom_table_content{
  width: 100% !important;
  min-width: 0 !important;
}
#modal_custom_table.modal-sale-series-only #modal_custom_table_div,
#modal_custom_table.modal-sale-series-only .modal_custom_table_table_container{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 0% !important;
  box-sizing: border-box !important;
}
#modal_custom_table.modal-sale-series-only #modal_custom_table_div .custom_table,
#modal_custom_table.modal-sale-series-only .modal_custom_table_table_container .custom_table{
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}
#modal_custom_table.modal-sale-series-only #modal_custom_table_div .custom_table_data,
#modal_custom_table.modal-sale-series-only .modal_custom_table_table_container .custom_table_data{
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  overflow-x: visible !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
}
#modal_custom_table.modal-sale-series-only .custom_table_data_row{
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
#modal_custom_table.modal-sale-series-only .custom_table_data_row .custom_table_data_column:nth-child(2){
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  display: block !important;
}

/* Επιλογή πελάτη: ίδιο layout με Επιλογή παραστατικού (πλήρες πλάτος, γραμμές μέχρι τέλος) */
#modal_custom_table.modal-customer-tax-only #modal_custom_table_content{
  width: 100% !important;
  min-width: 0 !important;
}
#modal_custom_table.modal-customer-tax-only #modal_custom_table_div,
#modal_custom_table.modal-customer-tax-only .modal_custom_table_table_container{
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 0% !important;
  box-sizing: border-box !important;
}
#modal_custom_table.modal-customer-tax-only #modal_custom_table_div .custom_table,
#modal_custom_table.modal-customer-tax-only .modal_custom_table_table_container .custom_table{
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}
#modal_custom_table.modal-customer-tax-only #modal_custom_table_div .custom_table_data,
#modal_custom_table.modal-customer-tax-only .modal_custom_table_table_container .custom_table_data{
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  overflow-x: visible !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
}
#modal_custom_table.modal-customer-tax-only .custom_table_data_row{
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
#modal_custom_table.modal-customer-tax-only .custom_table_data_row .custom_table_data_column:nth-child(2),
#modal_custom_table.modal-customer-tax-only .custom_table_data_row .custom_table_data_column:nth-child(3){
  box-sizing: border-box !important;
}

#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) #modal_custom_table_div .custom_table_data,
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .modal_custom_table_table_container .custom_table_data{
  overflow-y: auto !important;
}
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row{
  background: rgba(21, 31, 72, .78);
  border-top: 1px solid rgba(141, 163, 235, .12);
  height: auto;
  min-height: 50px;
  white-space: nowrap;
}
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row:nth-child(even){
  background: rgba(17, 26, 61, .82);
}
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row:hover{
  background: rgba(38, 53, 111, .92);
}
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row.row_selected{
  background: rgba(38, 53, 111, .92) !important;
  box-shadow: none !important;
}
#modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_column{
  color: var(--ctm-text);
  border-left-color: rgba(141, 163, 235, .12);
  font-size: 13px;
  padding-top: 6px;
  padding-bottom: 6px;
  box-sizing: border-box;
  min-height: 50px;
  line-height: 1.35;
  vertical-align: top;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1 !important;
  -webkit-text-fill-color: currentColor;
}

#modal_custom_table .custom_table_data_column,
#modal_custom_table .custom_table_data_column *{
  color: inherit !important;
  opacity: 1 !important;
  visibility: visible !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: none !important;
}
#modal_custom_table .custom_table_footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(141, 163, 235, .18);
}
#modal_custom_table .custom_table_footer_export_buttons,
#modal_custom_table .custom_table_footer_pagination{
  float: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#modal_custom_table .custom_table_footer_export_button,
#modal_custom_table .custom_table_footer_pagination_button{
  min-width: 36px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(141, 163, 235, .22);
  background: rgba(19, 30, 71, .88) !important;
  color: #e2eaff !important;
}
#modal_custom_table_actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}
#modal_custom_table_actions .btn{
  min-width: 104px;
  height: 38px;
  border-radius: 12px !important;
  font-weight: 700;
  box-shadow: none;
}
#modal_custom_table_actions #modal_custom_table_cancel{
  background: var(--ctm-button-secondary-bg) !important;
  border-color: var(--ctm-button-secondary-border) !important;
  color: var(--ctm-button-secondary-text) !important;
}
body.ui-v2-light #modal_custom_table,
body.orders-page.ui-v2-light #modal_custom_table{
  --ctm-backdrop: rgba(148, 163, 184, .22);
  --ctm-panel: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  --ctm-panel-border: #d7e2f2;
  --ctm-panel-shadow: 0 28px 60px rgba(15, 23, 42, .14);
  --ctm-card: rgba(246, 250, 255, .98);
  --ctm-card-border: #dde7f4;
  --ctm-title: #132847;
  --ctm-text: #334765;
  --ctm-button-secondary-bg: #ffffff;
  --ctm-button-secondary-border: #d2dced;
  --ctm-button-secondary-text: #2c4568;
  --ctm-checkbox-bg: #ffffff;
  --ctm-checkbox-border: #c8d5ea;
  --ctm-checkbox-checked-bg: #5f6dff;
  --ctm-checkbox-checked-border: #5f6dff;
}
body.ui-v2-light #modal_custom_table .custom_table_page_length,
body.ui-v2-light #modal_custom_table .custom_table_top_button_clear_filters,
body.ui-v2-light #modal_custom_table .custom_table_top_button_bulk_delete,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_page_length,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_top_button_clear_filters,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_top_button_bulk_delete{
  background: rgba(255, 255, 255, .98) !important;
  border-color: #cedbef !important;
  color: #284167 !important;
}
body.ui-v2-light #modal_custom_table .custom_table_header,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_header{
  background: rgba(233, 240, 254, .95);
  border-color: #d6e0f0;
}
body.ui-v2-light #modal_custom_table .custom_table_header_column,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_header_column{
  color: #6079a7;
  border-left-color: rgba(206, 220, 239, .95);
}
body.ui-v2-light #modal_custom_table .custom_table_search_row,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_row{
  background: rgba(246, 250, 255, .96);
  border-left-color: #dbe5f3;
  border-right-color: #dbe5f3;
}
body.ui-v2-light #modal_custom_table .custom_table_search_column,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column{
  border-left-color: rgba(221, 231, 244, .96);
}
body.ui-v2-light #modal_custom_table .custom_table_search_column input,
body.ui-v2-light #modal_custom_table .custom_table_search_column select,
body.ui-v2-light #modal_custom_table .custom_table_search_column button,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column input,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column select,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column button{
  background: #ffffff !important;
  border-color: #d2def0 !important;
  color: #284167 !important;
}
body.ui-v2-light #modal_custom_table .custom_table_search_column input::placeholder,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column input::placeholder{
  color: #8ea0c3;
}
body.ui-v2-light #modal_custom_table .custom_table_data,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data{
  border-color: #dbe5f3;
}
body.ui-v2-light #modal_custom_table .custom_table_data_row,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data_row{
  background: rgba(255, 255, 255, .98) !important;
  border-top-color: rgba(221, 231, 244, .9);
}
body.ui-v2-light #modal_custom_table .custom_table_data_row:nth-child(even),
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data_row:nth-child(even){
  background: rgba(247, 250, 255, .98) !important;
}
body.ui-v2-light #modal_custom_table .custom_table_data_row:hover,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data_row:hover{
  background: rgba(236, 243, 255, .98) !important;
}
body.ui-v2-light #modal_custom_table .custom_table_data_row.row_selected,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data_row.row_selected{
  background: linear-gradient(90deg, rgba(220, 232, 255, .98), rgba(210, 224, 255, .98)) !important;
}
body.ui-v2-light #modal_custom_table .custom_table_data_column,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data_column{
  color: #29405f;
  border-left-color: rgba(221, 231, 244, .9);
  font-weight: 600;
  background: transparent !important;
}
body.ui-v2-light #modal_custom_table .custom_table_footer,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_footer{
  border-top-color: #dbe5f3;
}
body.ui-v2-light #modal_custom_table .custom_table_footer_export_button,
body.ui-v2-light #modal_custom_table .custom_table_footer_pagination_button,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_footer_export_button,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_footer_pagination_button{
  background: rgba(255, 255, 255, .98) !important;
  border-color: #d2def0 !important;
  color: #284167 !important;
}

/* Product category: κράτα το modal custom table φωτεινό ανεξάρτητα από shell theme */
body.page-product-category #modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row{
  background: rgba(255, 255, 255, .98) !important;
  border-top-color: rgba(221, 231, 244, .9) !important;
}
body.page-product-category #modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row:nth-child(even){
  background: rgba(247, 250, 255, .98) !important;
}
body.page-product-category #modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row:hover{
  background: rgba(236, 243, 255, .98) !important;
}
body.page-product-category #modal_custom_table:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row.row_selected{
  background: linear-gradient(90deg, rgba(220, 232, 255, .98), rgba(210, 224, 255, .98)) !important;
}
@media (max-width: 900px){
  #modal_custom_table{
    padding: 12px;
  }
  #modal_custom_table_container{
    width: calc(100vw - 24px);
    max-width: 760px;
    margin: 0 auto;
  }
  #modal_custom_table_box{
    height: min(86vh, 760px);
    min-height: auto;
    padding: 12px;
    border-radius: 18px;
    gap: 12px;
  }
  #modal_custom_table_header{
    align-items: center;
  }
  #modal_custom_table_title{
    font-size: 24px;
  }
  #modal_custom_table .custom_table{
    padding: 12px;
    border-radius: 16px;
  }
  #modal_custom_table .custom_table_pre_header,
  #modal_custom_table .custom_table_page_length_box,
  #modal_custom_table .custom_table_top_buttons{
    width: 100%;
  }
  #modal_custom_table .custom_table_page_length,
  #modal_custom_table .custom_table_top_button,
  #modal_custom_table .custom_table_top_button_clear_filters{
    flex: 1 1 140px;
  }
  #modal_custom_table .custom_table_top_button_bulk_delete{
    flex: 0 0 42px;
  }
  #modal_custom_table .custom_table_data{
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
  #modal_custom_table_actions{
    justify-content: stretch;
  }
  #modal_custom_table_actions .btn{
    flex: 1 1 0;
    min-width: 0;
  }
}
/* =====================================================
   GLOBAL MODAL PICKERS / RELATION TABLES
   ===================================================== */
#modal_custom_table,
#app_modal #modal_custom_table{
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#modal_custom_table .custom_table_pre_header .glyphicon,
#modal_custom_table .custom_table_search_column .glyphicon,
#modal_custom_table .custom_table_top_button .glyphicon,
#modal_custom_table .custom_table_top_button_clear_filters .glyphicon,
#modal_custom_table .custom_table_top_button_bulk_delete .glyphicon{
  display: none !important;
}

#modal_custom_table .custom_table_page_length_box,
#modal_custom_table .custom_table_top_buttons{
  row-gap: 8px;
}

#modal_custom_table .custom_table_page_length,
#modal_custom_table .custom_table_top_button,
#modal_custom_table .custom_table_top_button_clear_filters,
#modal_custom_table .custom_table_top_button_bulk_delete,
#modal_custom_table .custom_table_footer_export_button,
#modal_custom_table .custom_table_footer_pagination_button{
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

#modal_custom_table .custom_table_page_length:hover,
#modal_custom_table .custom_table_top_button:hover,
#modal_custom_table .custom_table_top_button_clear_filters:hover,
#modal_custom_table .custom_table_top_button_bulk_delete:hover,
#modal_custom_table .custom_table_footer_export_button:hover,
#modal_custom_table .custom_table_footer_pagination_button:hover{
  transform: translateY(-1px);
}

#modal_custom_table .custom_table_header,
#modal_custom_table .custom_table_search_row,
#modal_custom_table .custom_table_data_row{
  position: relative;
}

#modal_custom_table .custom_table_header_column_select,
#modal_custom_table .custom_table_search_column_select,
#modal_custom_table .custom_table_data_column_select{
  display:inline-flex !important;
  align-items:center;
  justify-content:center;
  vertical-align:top;
}

#modal_custom_table .custom_table_checkbox_box{
  width: 20px;
  height: 20px;
  border-radius: 7px;
  border-color: var(--ctm-checkbox-border);
  background: var(--ctm-checkbox-bg);
}

#modal_custom_table #modal_custom_table_div .custom_table_checkbox_box,
#modal_custom_table .modal_custom_table_table_container .custom_table_checkbox_box{
  background: var(--ctm-checkbox-bg) !important;
  border-color: var(--ctm-checkbox-border) !important;
  box-shadow: inset 0 0 0 1px rgba(91, 116, 194, .14) !important;
}

#modal_custom_table .custom_table_data_row{
  transition: background-color .18s ease, box-shadow .18s ease;
}

#modal_custom_table .custom_table_data_row:hover .custom_table_data_column,
#modal_custom_table .custom_table_data_row.row_selected .custom_table_data_column{
  background: transparent !important;
}

#modal_custom_table .custom_table_data_column{
  border-bottom-color: transparent;
}

#modal_custom_table .custom_table_header_column,
#modal_custom_table .custom_table_search_column,
#modal_custom_table .custom_table_data_column{
  float:none !important;
}

#modal_custom_table .custom_table_data_row:last-child .custom_table_data_column{
  border-bottom-color: rgba(141, 163, 235, .12);
}

body.ui-v2-light #modal_custom_table .custom_table_page_length:hover,
body.ui-v2-light #modal_custom_table .custom_table_top_button_clear_filters:hover,
body.ui-v2-light #modal_custom_table .custom_table_top_button_bulk_delete:hover,
body.ui-v2-light #modal_custom_table .custom_table_footer_export_button:hover,
body.ui-v2-light #modal_custom_table .custom_table_footer_pagination_button:hover,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_page_length:hover,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_top_button_clear_filters:hover,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_top_button_bulk_delete:hover,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_footer_export_button:hover,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_footer_pagination_button:hover{
  background: #eef4ff !important;
  border-color: #bfd1ef !important;
  color: #1d3963 !important;
  box-shadow: 0 10px 18px rgba(122, 145, 190, .12);
}

body.ui-v2-light #modal_custom_table .custom_table_top_button:hover,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_top_button:hover{
  background: linear-gradient(180deg, #5c82ff, #4468f0) !important;
  border-color: #597cff !important;
  color: #fff !important;
  box-shadow: 0 14px 28px rgba(76, 96, 216, .24);
}

body.ui-v2-light #modal_custom_table .custom_table_search_column input:focus,
body.ui-v2-light #modal_custom_table .custom_table_search_column select:focus,
body.ui-v2-light #modal_custom_table .custom_table_search_column button:focus,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column input:focus,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column select:focus,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_search_column button:focus{
  box-shadow: 0 0 0 3px rgba(93, 128, 228, .16) !important;
  border-color: #88a5e5 !important;
}

body.ui-v2-light #modal_custom_table .custom_table_data_row.row_selected,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data_row.row_selected{
  background: linear-gradient(90deg, #e5efff, #d9e8ff) !important;
  box-shadow: inset 0 0 0 1px #c8d9f4;
}

body.ui-v2-light #modal_custom_table .custom_table_checkbox_box,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_checkbox_box{
  border-color: var(--ctm-checkbox-border) !important;
  background: var(--ctm-checkbox-bg) !important;
}

body.ui-v2-light #modal_custom_table .custom_table_checkbox input:checked + .custom_table_checkbox_box,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_checkbox input:checked + .custom_table_checkbox_box{
  background: var(--ctm-checkbox-checked-bg) !important;
  border-color: var(--ctm-checkbox-checked-border) !important;
  box-shadow: 0 10px 20px rgba(95, 109, 255, .16);
}

body.ui-v2-light #modal_custom_table #modal_custom_table_div .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box,
body.orders-page.ui-v2-light #modal_custom_table #modal_custom_table_div .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box,
body.ui-v2-light #modal_custom_table .modal_custom_table_table_container .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box,
body.orders-page.ui-v2-light #modal_custom_table .modal_custom_table_table_container .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box{
  background: #ffffff !important;
  border-color: #c8d5ea !important;
  box-shadow: none !important;
}

body.ui-v2-light #modal_custom_table,
body.orders-page.ui-v2-light #modal_custom_table{
  overflow: hidden !important;
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_page_length:hover,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_top_button_clear_filters:hover,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_top_button_bulk_delete:hover,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_footer_export_button:hover,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_footer_pagination_button:hover{
  background: rgba(32, 48, 102, .96) !important;
  border-color: #536fbf !important;
  color: #eef4ff !important;
  box-shadow: 0 14px 26px rgba(7, 14, 40, .28);
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_top_button:hover{
  background: linear-gradient(180deg, #746dff, #5966ff) !important;
  border-color: #7b79ff !important;
  box-shadow: 0 16px 30px rgba(88, 98, 255, .28);
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_search_column input:focus,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_search_column select:focus,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_search_column button:focus{
  box-shadow: 0 0 0 3px rgba(110, 98, 255, .18) !important;
  border-color: #6b63ff !important;
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox_box{
  border-color: var(--ctm-checkbox-border) !important;
  background: var(--ctm-checkbox-bg) !important;
  box-shadow: inset 0 0 0 1px rgba(91, 116, 194, .14) !important;
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox_box{
  border-color: #4a61a7 !important;
  background: #142051 !important;
  box-shadow: inset 0 0 0 1px rgba(91, 116, 194, .14) !important;
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box{
  background: #142051 !important;
  border-color: #4a61a7 !important;
  box-shadow: inset 0 0 0 1px rgba(91, 116, 194, .14) !important;
}

body:not(.ui-v2-light) #modal_custom_table #modal_custom_table_div .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table #modal_custom_table_div .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box,
body:not(.ui-v2-light) #modal_custom_table .modal_custom_table_table_container .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .modal_custom_table_table_container .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box{
  background: #142051 !important;
  border-color: #4a61a7 !important;
  box-shadow: inset 0 0 0 1px rgba(91, 116, 194, .14) !important;
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox input:checked + .custom_table_checkbox_box{
  background: var(--ctm-checkbox-checked-bg) !important;
  border-color: var(--ctm-checkbox-checked-border) !important;
  box-shadow: 0 12px 24px rgba(107, 99, 255, .24);
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox input:checked + .custom_table_checkbox_box{
  background: #5f6dff !important;
  border-color: #5f6dff !important;
  box-shadow: 0 12px 24px rgba(95, 109, 255, .24) !important;
}

body:not(.ui-v2-light) #modal_custom_table #modal_custom_table_div .custom_table_checkbox input:checked + .custom_table_checkbox_box,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table #modal_custom_table_div .custom_table_checkbox input:checked + .custom_table_checkbox_box,
body:not(.ui-v2-light) #modal_custom_table .modal_custom_table_table_container .custom_table_checkbox input:checked + .custom_table_checkbox_box,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .modal_custom_table_table_container .custom_table_checkbox input:checked + .custom_table_checkbox_box{
  background: #5f6dff !important;
  border-color: #5f6dff !important;
  box-shadow: 0 12px 24px rgba(95, 109, 255, .24) !important;
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox input:checked + .custom_table_checkbox_box .custom_table_icon_check{
  opacity: 1 !important;
  transform: scale(1) !important;
  border-left-color: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box .custom_table_icon_check,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box .custom_table_icon_check{
  opacity: 0 !important;
  transform: scale(.7) !important;
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_data_column{
  color: #e2eaff !important;
  font-weight: 600;
  background: transparent !important;
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_data_column{
  color: #e2eaff !important;
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_data_row:first-child .custom_table_data_column{
  border-top-color: #17214d !important;
}

body:not(.ui-v2-light) #modal_custom_table .custom_table_data_row::before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:1px;
  background:#17214d;
  pointer-events:none;
  z-index:3;
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_data_row.row_selected{
  background: linear-gradient(90deg, rgba(76, 96, 180, .94), rgba(53, 72, 149, .96)) !important;
  box-shadow: inset 0 0 0 1px rgba(133, 151, 231, .22);
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_header,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_search_row{
  overflow: hidden;
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table::before,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_header::before,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_search_row::before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:1px;
  background:#17214d;
  pointer-events:none;
  z-index:5;
}

body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table::after,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_header::after,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_search_row::after{
  content:"";
  position:absolute;
  top:0;
  right:0;
  width:1px;
  bottom:0;
  background:#17214d;
  pointer-events:none;
  z-index:5;
}

@media (max-width: 700px){
  #modal_custom_table{
    padding: 10px;
  }
  #modal_custom_table_container{
    width: calc(100vw - 20px);
  }
  #modal_custom_table_box{
    min-height: 0;
    height: min(88vh, 760px);
    max-height: calc(100vh - 20px);
    border-radius: 18px;
  }
  #modal_custom_table_header{
    gap: 12px;
    align-items: center;
  }
  #modal_custom_table_title{
    font-size: 20px;
    line-height: 1.12;
  }
  #modal_custom_table_close{
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 24px;
  }
  #modal_custom_table .custom_table{
    padding: 10px;
    border-radius: 14px;
  }
  #modal_custom_table .custom_table_pre_header{
    margin-bottom: 8px;
  }
  #modal_custom_table .custom_table_page_length,
  #modal_custom_table .custom_table_top_button,
  #modal_custom_table .custom_table_top_button_clear_filters,
  #modal_custom_table .custom_table_top_button_bulk_delete{
    height: 34px;
    border-radius: 10px;
    font-size: 12px;
    padding: 0 12px;
  }
  #modal_custom_table .custom_table_header_column{
    font-size: 10px;
  }
  #modal_custom_table .custom_table_search_column input,
  #modal_custom_table .custom_table_search_column select,
  #modal_custom_table .custom_table_search_column button{
    height: 32px !important;
    font-size: 12px !important;
  }
  #modal_custom_table .custom_table_data{
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
  #modal_custom_table .custom_table_data_column{
    font-size: 12px;
  }
  #modal_custom_table_actions .btn{
    height: 36px;
    min-width: 0;
  }
}

/* Final modal picker overrides.
   These must win over shell/page rules and keep a single real scroll area. */
#modal_custom_table #modal_custom_table_content,
#modal_custom_table #modal_custom_table_div,
#modal_custom_table .modal_custom_table_table_container,
#modal_custom_table .custom_table{
  overflow: hidden !important;
}

#modal_custom_table .custom_table_data,
body.ui-v2-shell-active:not(.ui-v2-light) #modal_custom_table .custom_table_data,
body:not(.ui-v2-light) #modal_custom_table .custom_table_data,
body.ui-v2-light #modal_custom_table .custom_table_data,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_data{
  overflow-y: auto !important;
  overflow-x: hidden !important;
  pointer-events: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

#modal_custom_table .custom_table_checkbox{
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

#modal_custom_table .custom_table_checkbox input{
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
}

#modal_custom_table .custom_table_checkbox_box{
  background: #142051 !important;
  border-color: #4a61a7 !important;
  box-shadow: inset 0 0 0 1px rgba(91, 116, 194, .14) !important;
}

#modal_custom_table .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box{
  background: #142051 !important;
  border-color: #4a61a7 !important;
}

#modal_custom_table .custom_table_checkbox input:checked + .custom_table_checkbox_box{
  background: #5f6dff !important;
  border-color: #5f6dff !important;
  box-shadow: 0 12px 24px rgba(95, 109, 255, .24) !important;
}

#modal_custom_table .custom_table_checkbox input:checked + .custom_table_checkbox_box .custom_table_icon_check{
  opacity: 1 !important;
  transform: scale(1) !important;
  border-left-color: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

#modal_custom_table .custom_table_checkbox input:not(:checked) + .custom_table_checkbox_box .custom_table_icon_check{
  opacity: 0 !important;
  transform: scale(.7) !important;
}

body.ui-v2-light #modal_custom_table .custom_table_checkbox_box,
body.orders-page.ui-v2-light #modal_custom_table .custom_table_checkbox_box{
  background: #ffffff !important;
  border-color: #c8d5ea !important;
  box-shadow: none !important;
}

/* Final modal theme lock so picker styles follow the active theme, not page-wide custom_table rules. */
#modal_custom_table.modal-theme-light{
  --ctm-backdrop: rgba(148, 163, 184, .22);
  --ctm-panel: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  --ctm-panel-border: #d7e2f2;
  --ctm-panel-shadow: 0 28px 60px rgba(15, 23, 42, .14);
  --ctm-card: rgba(246, 250, 255, .98);
  --ctm-card-border: #dde7f4;
  --ctm-title: #132847;
  --ctm-text: #334765;
  --ctm-button-secondary-bg: #ffffff;
  --ctm-button-secondary-border: #d2dced;
  --ctm-button-secondary-text: #2c4568;
  --ctm-checkbox-bg: #ffffff;
  --ctm-checkbox-border: #c8d5ea;
  --ctm-checkbox-checked-bg: #5f6dff;
  --ctm-checkbox-checked-border: #5f6dff;
}

#modal_custom_table.modal-theme-light #modal_custom_table_box{
  background: var(--ctm-panel) !important;
  border-color: var(--ctm-panel-border) !important;
  box-shadow: var(--ctm-panel-shadow) !important;
}

#modal_custom_table.modal-theme-light .custom_table{
  background: var(--ctm-card) !important;
  border-color: var(--ctm-card-border) !important;
}

#modal_custom_table.modal-theme-light #modal_custom_table_title{
  color: var(--ctm-title) !important;
}

#modal_custom_table.modal-theme-light #modal_custom_table_close,
#modal_custom_table.modal-theme-light #modal_custom_table_cancel{
  background: #ffffff !important;
  border-color: #d2dced !important;
  color: #2c4568 !important;
}

#modal_custom_table.modal-theme-light .custom_table_page_length,
#modal_custom_table.modal-theme-light .custom_table_top_button_clear_filters,
#modal_custom_table.modal-theme-light .custom_table_top_button_bulk_delete,
#modal_custom_table.modal-theme-light .custom_table_footer_export_button,
#modal_custom_table.modal-theme-light .custom_table_footer_pagination_button{
  background: rgba(255, 255, 255, .98) !important;
  border-color: #cedbef !important;
  color: #284167 !important;
}

#modal_custom_table.modal-theme-light .custom_table_header{
  background: rgba(233, 240, 254, .95) !important;
  border-color: #d6e0f0 !important;
}

#modal_custom_table.modal-theme-light .custom_table_header_column{
  color: #6079a7 !important;
  border-left-color: rgba(206, 220, 239, .95) !important;
}

#modal_custom_table.modal-theme-light .custom_table_search_row{
  background: rgba(246, 250, 255, .96) !important;
  border-left-color: #dbe5f3 !important;
  border-right-color: #dbe5f3 !important;
}

#modal_custom_table.modal-theme-light .custom_table_search_column{
  border-left-color: rgba(221, 231, 244, .96) !important;
}

#modal_custom_table.modal-theme-light .custom_table_search_column input,
#modal_custom_table.modal-theme-light .custom_table_search_column select,
#modal_custom_table.modal-theme-light .custom_table_search_column button{
  background: #ffffff !important;
  border-color: #d2def0 !important;
  color: #284167 !important;
}

#modal_custom_table.modal-theme-light .custom_table_search_column input::placeholder{
  color: #8ea0c3 !important;
}

#modal_custom_table.modal-theme-light .custom_table_data{
  border-color: #dbe5f3 !important;
}

#modal_custom_table.modal-theme-light .custom_table_data_row{
  background: rgba(255, 255, 255, .98) !important;
  border-top-color: rgba(221, 231, 244, .9) !important;
}

#modal_custom_table.modal-theme-light .custom_table_data_row:nth-child(even){
  background: rgba(247, 250, 255, .98) !important;
}

#modal_custom_table.modal-theme-light .custom_table_data_row:hover{
  background: rgba(236, 243, 255, .98) !important;
}

#modal_custom_table.modal-theme-light:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row.row_selected,
#modal_custom_table.modal-theme-light:not(.modal-sale-series-only):not(.modal-customer-tax-only) .custom_table_data_row.row_selected:hover{
  background: rgba(236, 243, 255, .98) !important;
  box-shadow: none !important;
}

#modal_custom_table.modal-theme-light .custom_table_data_column{
  color: #29405f !important;
  border-left-color: rgba(221, 231, 244, .9) !important;
  background: transparent !important;
}

#modal_custom_table.modal-theme-light .custom_table_footer{
  border-top-color: #dbe5f3 !important;
}
