/* ==========================================================================
   Antigravity CRM - MISA AMIS Modern Enterprise Theme & Components
   Fixed: Disabled text-overflow ellipsis on action columns & buttons to eliminate dots.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-sidebar: #ffffff;
  --border-color: #e2e8f0;
  
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --active-menu-bg: #e0e7ff;
  --active-menu-color: #1e40af;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Hide number input spinners globally */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* ==========================================================================
   TOP BAR HEADER
   ========================================================================== */
.crm-topbar {
  height: 52px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.brand-icon-circle {
  width: 32px;
  height: 32px;
  background: #2563eb;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.brand-name {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.topbar-search-box {
  position: relative;
  width: 420px;
}
.topbar-search-input {
  width: 100%;
  padding: 6px 12px 6px 34px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 12.5px;
  color: #334155;
  outline: none;
  transition: all 0.15s ease;
}
.topbar-search-input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 13px;
}

.topbar-right-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar-icon-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 17px;
  color: #475569;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.topbar-icon-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}
.topbar-badge-red {
  position: absolute;
  top: -2px;
  right: -4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  line-height: 1;
}
.user-avatar-circle {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border-radius: 50%;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ==========================================================================
   APP LAYOUT
   ========================================================================== */
.crm-layout {
  display: flex;
  min-height: calc(100vh - 52px);
  background: #f1f5f9;
}

.crm-sidebar {
  width: 210px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 12px 8px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.sidebar-menu {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  gap: 2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #334155;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.sidebar-item:hover {
  background: #f8fafc;
  color: #1d4ed8;
}
.sidebar-item.active {
  background: var(--active-menu-bg);
  color: var(--active-menu-color);
  font-weight: 700;
}

.crm-main-content {
  flex: 1;
  padding: 16px 20px;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   PAGE HEADER & TOOLBAR
   ========================================================================== */
.page-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.page-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-main-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.page-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-amis-outline {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-amis-outline:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-amis-primary {
  background: #2563eb !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  transition: all 0.15s ease;
}
.btn-amis-primary:hover {
  background: #1d4ed8 !important;
}

/* ==========================================================================
   ENTERPRISE DATA TABLE
   ========================================================================== */
.table-card-container {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.table-filter-bar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
}
.smart-search-input-wrapper {
  position: relative;
  width: 320px;
}
.smart-search-input {
  width: 100%;
  padding: 6px 12px 6px 30px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 12px;
  outline: none;
}
.smart-search-input:focus {
  border-color: #2563eb;
  background: #ffffff;
}
.smart-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 12px;
}

.table-scroll-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.amis-data-table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
  table-layout: fixed;
}

.amis-data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  font-size: 12px;
  user-select: none;
  position: relative;
}

/* COLUMN FILTER BUTTON & HOVER STYLES */
.th-filterable {
  position: relative;
}

.btn-col-filter {
  background: #e2e8f0;
  border: none;
  color: #475569;
  padding: 3px 5px;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.th-filterable:hover .btn-col-filter,
.btn-col-filter.active {
  opacity: 1;
}

.btn-col-filter:hover {
  background: #cbd5e1;
  color: #0f172a;
}

.btn-col-filter.active {
  background: #dbeafe !important;
  color: #2563eb !important;
  opacity: 1 !important;
  box-shadow: 0 0 0 1px #93c5fd;
}

/* DRAGGABLE COLUMN RESIZER HANDLE */
.col-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
  z-index: 10;
}
.col-resizer:hover, .col-resizer.resizing {
  background: #2563eb;
}

/* CHECKBOX COLUMN & ACTION COLUMNS: NO ELLIPSIS DOTS AT ALL */
.amis-data-table td.col-checkbox,
.amis-data-table th.col-checkbox {
  text-overflow: clip !important;
  overflow: visible !important;
  white-space: nowrap !important;
  text-align: center !important;
  width: 44px !important;
  padding: 8px 4px !important;
}

.amis-data-table td.col-actions,
.amis-data-table th.col-actions {
  text-overflow: clip !important;
  overflow: visible !important;
  white-space: nowrap !important;
  text-align: center !important;
  width: 110px !important;
  padding: 6px 8px !important;
}

/* REGULAR CELL WEIGHT: Normal */
.amis-data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

.amis-data-table td:has(input),
.amis-data-table td:has(textarea),
.amis-data-table td:has(select),
.amis-data-table td.cell-input-wrapper {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
}

textarea.form-control,
textarea.row-title {
  resize: vertical;
  min-height: 44px;
  overflow: auto !important;
  text-overflow: clip !important;
  white-space: normal !important;
}

.amis-data-table tbody tr:hover {
  background: #f0f7ff;
}

.amis-checkbox {
  width: 15px;
  height: 15px;
  accent-color: #2563eb;
  cursor: pointer;
  margin: 0 auto;
  display: block;
}

/* Status Pills */
.status-pill-blue {
  background: #dbeafe;
  color: #1e40af;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-block;
}
.status-pill-green {
  background: #dcfce7;
  color: #15803d;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-block;
}
.status-pill-yellow {
  background: #fef3c7;
  color: #d97706;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-block;
}
.status-pill-grey {
  background: #f1f5f9;
  color: #64748b;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-block;
}
.status-pill-red {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-block;
}

/* Code Links */
.table-code-link {
  color: #2563eb;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.table-code-link:hover {
  text-decoration: underline;
}

.cust-company-name {
  font-weight: 400;
  color: #1e3a8a;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-container.modal-fullscreen {
  width: 98vw !important;
  height: 96vh !important;
  max-width: 98vw !important;
  max-height: 96vh !important;
  margin: auto;
  border-radius: 8px;
}

/* Sticky Bottom Summary Bar */
.table-footer-summary-bar {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #334155;
  font-weight: 500;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

.footer-summary-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.footer-sum-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer-sum-item strong {
  color: #0f172a;
  font-weight: 700;
}

.footer-pagination-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: #374151;
}

.pagination-label {
  font-size: 13px;
  color: #4b5563;
  font-weight: 400;
}

.pagination-select {
  height: 32px;
  padding: 2px 28px 2px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
}

.pagination-select:hover {
  border-color: #9ca3af;
}

.pagination-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

.pagination-range {
  font-size: 13.5px;
  color: #111827;
  font-weight: 700;
  margin: 0 4px;
  letter-spacing: 0.5px;
}

.pagination-arrows-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-nav-btn {
  background: transparent;
  border: none;
  outline: none;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.pagination-nav-btn:not(.disabled):hover {
  color: #1f2937;
  background: #f1f5f9;
}

.pagination-nav-btn.disabled {
  color: #d1d5db;
  cursor: not-allowed;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-container {
  background: #ffffff;
  border-radius: 10px;
  width: 92%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.15);
  overflow: hidden;
}
.modal-container.modal-xl {
  max-width: 1200px;
}
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
}
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.form-label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}
.req-star {
  color: #ef4444;
}
.form-control {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 12.5px;
  outline: none;
}
.form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.modal-tab-header {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 14px;
}
.modal-tab-btn {
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -2px;
}
.modal-tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* ==========================================================================
   PRINT MEDIA STYLES - CENTERED A4 LANDSCAPE WITH MULTI-PAGE SUPPORT
   ========================================================================== */
@media print {
  html, body {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }
  body * {
    visibility: hidden !important;
  }
  #print-area-landscape, #print-area-landscape * {
    visibility: visible !important;
  }
  #print-area-landscape {
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 5mm 10mm !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
  }
  #print-area-landscape table {
    width: 100% !important;
  }
  #print-area-landscape table tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  #print-area-landscape table thead {
    display: table-header-group !important;
  }
  .print-terms-block, .print-signature-block {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  @page {
    size: A4 landscape;
    margin: 8mm 8mm 8mm 8mm;
  }
}

/* ==========================================================================
   MISA AMIS CRM REPORTS PAGE 2-PANE FOLDER LAYOUT & STYLING
   ========================================================================== */
.reports-layout-wrapper {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  min-height: calc(100vh - 140px);
}

.reports-sidebar-card {
  width: 240px;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
}

.reports-sidebar-header {
  padding: 4px 16px 10px 16px;
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
}

.reports-folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px;
  color: #334155;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.reports-folder-item:hover {
  background: #f8fafc;
  color: #1e293b;
}

.reports-folder-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 700;
  border-left-color: #2563eb;
}

.reports-folder-badge {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 7px;
  border-radius: 10px;
}

.reports-folder-item.active .reports-folder-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.reports-main-card {
  flex: 1;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.report-star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #cbd5e1;
  transition: color 0.15s ease, transform 0.15s ease;
  padding: 0 4px;
}

.report-star-btn:hover,
.report-star-btn.starred {
  color: #f59e0b;
}


