/**
 * Fincoreks — fc-portal-ui.css (shtresë e dytë)
 * Ngarkohet PAS theme-enterprise.css. Qëllim: përmbajtje brenda viewport-it,
 * minmax(0,1fr) për grid/flex, tabela me scroll horizontal të kontrolluar.
 * body.fc-design-pro — klient + admin portal v2.
 */

body.fc-design-pro {
  --fc-ui-max: min(1420px, 100%);
  --fc-ui-pad-x: clamp(14px, 3vw, 28px);
  --fc-ui-pad-y: clamp(10px, 2vw, 20px);
  --fc-ui-radius: 16px;
  --fc-ui-gap: clamp(12px, 2vw, 20px);
}

body.fc-design-pro,
body.fc-design-pro * {
  box-sizing: border-box;
}

body.fc-design-pro {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  font-family: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Shell: kolona e djathtë gjithmonë mund të tkurret (parandalon overflow horizontal) */
body.fc-design-pro .fc-shell.fc-shell--light {
  display: grid;
  grid-template-columns: minmax(220px, 272px) minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  min-height: 100dvh;
  align-items: stretch;
}

body.fc-design-pro .fc-main {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

body.fc-design-pro .fc-page {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--fc-ui-max);
  margin-inline: auto;
  padding: var(--fc-ui-pad-y) var(--fc-ui-pad-x);
}

/* Topbar: nuk shtyn faqen jashtë gjerësisë */
body.fc-design-pro .fc-topbar {
  width: 100%;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px 16px;
  row-gap: 12px;
}

body.fc-design-pro .fc-topbar-left,
body.fc-design-pro .fc-topbar-right {
  min-width: 0;
}

body.fc-design-pro .fc-topbar-copy {
  min-width: 0;
}

body.fc-design-pro .fc-topbar-copy h2 {
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  line-height: 1.25;
  word-break: break-word;
}

body.fc-design-pro .fc-topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 100%;
}

/* Header moduli */
body.fc-design-pro .fc-workspace-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  max-width: 100%;
}

body.fc-design-pro .fc-workspace-copy {
  min-width: 0;
  flex: 1 1 280px;
}

body.fc-design-pro .fc-toolbar-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 100%;
}

/* Karta kryesore e përmbajtjes */
body.fc-design-pro .fc-view-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

body.fc-design-pro .fc-view-card--dashboard {
  overflow: visible;
}

/* Tabela: scroll brenda zonës, jo faqja e tërë */
body.fc-design-pro .fc-table-scroller {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--fc-ui-radius);
  overscroll-behavior-x: contain;
}

body.fc-design-pro .fc-data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: clamp(12px, 1.15vw, 14px);
}

body.fc-design-pro .fc-data-table th,
body.fc-design-pro .fc-data-table td {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

/* Dashboard: 70/30 me minmax(0) */
body.fc-design-pro .fc-dashboard-main {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(260px, 3fr);
  gap: var(--fc-ui-gap);
  width: 100%;
  max-width: 100%;
  align-items: start;
}

body.fc-design-pro .fc-dashboard-plots {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--fc-ui-gap);
}

body.fc-design-pro .fc-action-card {
  min-width: 0;
  max-width: 100%;
}

body.fc-design-pro .fc-plot-board {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

body.fc-design-pro .fc-plot-columns {
  max-width: 100%;
}

/* KPI / SaaS rreshta */
body.fc-design-pro .fc-saas-kpi-row,
body.fc-design-pro .fc-saas-kpi-row--secondary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

body.fc-design-pro .fc-saas-kpi-card {
  min-width: 0;
}

body.fc-design-pro .fc-dashboard-net-row {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px;
}

body.fc-design-pro .fc-dashboard-bottom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--fc-ui-gap);
  width: 100%;
  max-width: 100%;
}

body.fc-design-pro .fc-dash-section.fc-payments-panel {
  width: 100%;
  max-width: 100%;
}

body.fc-design-pro .fc-payments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 10px;
  width: 100%;
}

/* Blerjet / module tabs */
body.fc-design-pro .fc-module-tabs {
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

body.fc-design-pro .fc-filter-tab {
  max-width: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

/* Forma & karta */
body.fc-design-pro .fc-form-card,
body.fc-design-pro .fc-table-card {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

body.fc-design-pro .fc-page-toolbar {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.fc-design-pro .fc-page-search {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  width: 100%;
  max-width: 100%;
}

body.fc-design-pro .fc-page-search .fc-search,
body.fc-design-pro .fc-page-search .fc-input {
  min-width: 0;
  flex: 1 1 180px;
  max-width: 100%;
}

/* Gridë të përbashkëta */
body.fc-design-pro .fc-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--fc-ui-gap);
  width: 100%;
  max-width: 100%;
}

body.fc-design-pro .fc-grid-2 > * {
  min-width: 0;
}

/* Skanim / workspace */
body.fc-design-pro .fc-scan-workspace {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

body.fc-design-pro .fc-scan-sheet {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Media */
body.fc-design-pro img,
body.fc-design-pro video,
body.fc-design-pro canvas,
body.fc-design-pro svg:not([width]):not([height]) {
  max-width: 100%;
  height: auto;
}

/* Fatura / preview kolona */
body.fc-design-pro .fc-invoice-preview-columns,
body.fc-design-pro .fc-tax-grid {
  max-width: 100%;
}

/* Toolbar dashboard filtra */
body.fc-design-pro .fc-dashboard-filters--bar {
  flex-wrap: wrap;
  max-width: 100%;
  gap: 10px;
}

body.fc-design-pro .fc-dashboard-global-search,
body.fc-design-pro .fc-dashboard-welcome {
  max-width: 100%;
}

body.fc-design-pro .fc-dashboard-search-row {
  flex-wrap: wrap;
  max-width: 100%;
}

body.fc-design-pro .fc-dashboard-search-input {
  min-width: 0;
  flex: 1 1 200px;
  max-width: 100%;
}

/* Modal (nëse klasa ekziston) */
body.fc-design-pro .fc-modal__dialog,
body.fc-design-pro .fc-modal--scan .fc-modal__dialog {
  max-width: min(560px, calc(100vw - 32px));
  max-height: min(90dvh, calc(100vh - 32px));
  overflow: auto;
}

/* Tablet: dashboard një kolonë */
@media (max-width: 1100px) {
  body.fc-design-pro .fc-dashboard-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Mobile: përforco min-width 0 (theme tashmë trajton sidebar) */
@media (max-width: 1024px) {
  body.fc-design-pro .fc-main {
    width: 100%;
  }

  body.fc-design-pro .fc-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  body.fc-design-pro .fc-topbar-right {
    justify-content: flex-start;
  }
}
