/* Factory System: small changes on top of the standard back-office look. */
:root, html[data-theme="light"] {
  --primary: #1f4e79;
  --secondary: #163a5c;
  --header-color: #ffffff;
  --header-link-color: #ffffff;
  --link-fg: #1f5a8f;
  --link-hover-color: #0f3557;
  --fs-bar-bg: #e3e8ee;
  --fs-bar-fill: #2a7652;
}
html[data-theme="dark"] {
  --fs-bar-bg: #2b333b;
  --fs-bar-fill: #6cc59a;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { --fs-bar-bg: #2b333b; --fs-bar-fill: #6cc59a; }
}

#site-name .fs-company {
  display: inline-block;
  margin-inline-start: 12px;
  padding-inline-start: 12px;
  border-inline-start: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 0.8em;
  font-weight: 400;
  opacity: 0.9;
}

.fs-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; justify-content: flex-end; }
.fs-inline { display: inline; margin: 0; }
.fs-link { background: none; border: 0; color: var(--header-link-color); cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }
.fs-tools select { font-size: 12px; padding: 2px 4px; max-width: 220px; }
.fs-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.fs-panel {
  overflow-x: auto;
  box-sizing: border-box;
  border: 1px solid var(--hairline-color);
  border-radius: 6px;
  padding: 14px 16px 6px;
  margin-bottom: 24px;
  background: var(--body-bg);
}
.fs-panel-head h2 { margin: 0 0 4px; font-size: 1.05rem; color: var(--body-fg); background: none; padding: 0; text-transform: none; letter-spacing: 0; }
.fs-panel-head p { margin: 0 0 10px; color: var(--body-quiet-color); max-width: 70ch; }
.fs-progress { width: 100%; }
.fs-progress th, .fs-progress td { vertical-align: middle; }
.fs-progress tbody th { white-space: nowrap; }
.fs-progress .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-bar { display: inline-block; width: 64px; height: 8px; border-radius: 4px; background: var(--fs-bar-bg); vertical-align: middle; overflow: hidden; }
.fs-bar span { display: block; height: 100%; background: var(--fs-bar-fill); }
.fs-pct { margin-inline-start: 6px; font-variant-numeric: tabular-nums; color: var(--body-quiet-color); }

[lang="ur"], html[lang="ur"] body { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Segoe UI", Tahoma, sans-serif; }
.fs-progress td:last-child { white-space: nowrap; }

/* Documents */
.fs-docbar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin: 0 0 12px; border: 1px solid var(--hairline-color); border-radius: 6px; background: var(--darkened-bg); }
.fs-docnum { font-weight: 700; font-size: 1.05rem; margin-inline-end: 10px; font-variant-numeric: tabular-nums; }
.fs-docstatus { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.8rem; font-weight: 600; background: #eef1f4; color: #333; }
.fs-st-draft, .fs-st-submitted { background: #fff3cd; color: #6b5200; }
.fs-st-posted, .fs-st-approved, .fs-st-received, .fs-st-costed { background: #e3eee7; color: #1f5c3e; }
.fs-st-in_transit, .fs-st-part_received, .fs-st-at_port, .fs-st-cleared, .fs-st-in_progress { background: #dce8f3; color: #174a77; }
.fs-st-cancelled, .fs-st-closed, .fs-st-retired { background: #eee; color: #555; }
.fs-docmeta { margin-inline-start: 10px; color: var(--body-quiet-color); font-size: 0.85rem; }
.fs-docactions { display: flex; flex-wrap: wrap; gap: 8px; }
.fs-docactions .button { padding: 7px 14px; cursor: pointer; }
.fs-hint { color: var(--body-quiet-color); margin: -4px 0 12px; font-size: 0.85rem; }

/* Home: waiting for action */
.fs-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.fs-tile a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--hairline-color); text-decoration: none; color: var(--body-fg); background: var(--body-bg); height: 100%; box-sizing: border-box; }
.fs-tile a:hover { border-color: var(--link-fg); }
.fs-tile-n { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fs-tile-l { font-size: 0.85rem; color: var(--body-quiet-color); }
.fs-tone-warn .fs-tile-n { color: #8a6d00; }
.fs-tone-bad .fs-tile-n { color: #b42318; }
.fs-tone-quiet .fs-tile-n { color: var(--body-quiet-color); }
.fs-tiles li { margin: 0; padding: 0; list-style: none; }

/* Reports and sales screens */
.fs-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 10px; padding: 0; list-style: none; }
.fs-links li { margin: 0; padding: 0; list-style: none; }
.fs-table { width: 100%; border-collapse: collapse; }
.fs-table th, .fs-table td { padding: 6px 8px; border-bottom: 1px solid var(--hairline-color); vertical-align: top; }
.fs-table thead th { background: var(--darkened-bg); text-align: start; font-weight: 600; }
.fs-table .num, .fs-table td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-table tfoot td, .fs-table tfoot th { font-weight: 700; border-top: 2px solid var(--hairline-color); }
.fs-bad { color: #b42318; font-weight: 600; }
.fs-warn { color: #8a6d00; font-weight: 600; }
.fs-good { color: #2a7652; font-weight: 600; }
.fs-quiet { color: var(--body-quiet-color); }
.fs-holds { margin: 0; padding-inline-start: 1.2em; }
.fs-holds li { margin-bottom: 4px; }
.fs-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: end; margin: 0 0 12px; }
.fs-filters label { display: block; font-size: 0.8rem; color: var(--body-quiet-color); }
.fs-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 14px; }
.fs-sum div { border: 1px solid var(--hairline-color); border-radius: 6px; padding: 8px 10px; }
.fs-sum b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.fs-sum span { color: var(--body-quiet-color); font-size: 0.8rem; }
@media print { #header, .breadcrumbs, #nav-sidebar, .fs-filters, .object-tools, #toggle-nav-sidebar { display: none !important; } }

/* Line tables: long names in a dropdown do not push the table past the page edge. */
.inline-group .tabular td select { max-width: 15rem; }
.inline-group .tabular td input:not([type=checkbox]) { max-width: 11rem; box-sizing: border-box; }

/* Accounts reports: a heading that only shows on paper (company, report, when printed). */
.fs-print-only { display: none; }
.fs-statement td.amount, .fs-statement th.amount { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-statement tr.group td { font-weight: 600; }
.fs-statement tr.total td { font-weight: 600; border-top: 1px solid var(--hairline-color); }
.fs-statement tr.result td { font-weight: 700; border-top: 2px solid var(--hairline-color); background: var(--darkened-bg); }
@media print {
  .fs-print-only { display: block; margin: 0 0 8px; }
  .fs-no-print, .messagelist, #footer { display: none !important; }
  #content { padding: 0 !important; }
  .fs-table, .fs-statement { font-size: 11px; }
  a { color: inherit; text-decoration: none; }
}

/* Owner's dashboard: one column on a phone, two or more side by side on a wide screen. */
.fs-dash-intro { margin: 0 0 12px; }
.fs-dash .fs-sum b a { color: inherit; }
.fs-dash .fs-sum span { display: block; }
.fs-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 0 18px; align-items: start; }
.fs-dash .fs-panel { margin-bottom: 18px; }
.fs-dash .fs-panel-head { display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.fs-dash .fs-panel-head a { font-size: 0.85rem; }
.fs-dash .fs-table { font-size: 0.9rem; }
.fs-dash .fs-table th, .fs-dash .fs-table td { padding: 5px 6px; }
.fs-dash .fs-dash-sub { margin-top: 10px; }
.fs-dash .fs-dash-group th { background: var(--darkened-bg); font-weight: 600; }
.fs-dash-wide { grid-column: 1 / -1; }
.fs-approvals { list-style: none; margin: 0 0 8px; padding: 0; }
.fs-approvals li { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; margin: 0; border-bottom: 1px solid var(--hairline-color); list-style: none; }
.fs-approvals .n { min-width: 2em; text-align: end; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: #8a6d00; }
.fs-dash .fs-table tfoot th, .fs-dash .fs-table tfoot td { font-size: inherit; color: var(--body-fg); }
.fs-dash .fs-show-small { display: none; }
@media (max-width: 767px) {
  .fs-dash .fs-panel { padding: 10px 10px 4px; }
  .fs-dash .fs-table th, .fs-dash .fs-table td { padding: 4px 3px; }
  .fs-dash .fs-hide-small { display: none; }
  .fs-dash .fs-show-small { display: inline; }
  .fs-dash .fs-sum, .fs-dash .fs-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Reports of stage 7: wide tables scroll sideways on a small screen; alerts and the daily summary. */
.fs-scroll { overflow-x: auto; }
.fs-report .fs-table { font-size: 0.86rem; }
.fs-report .fs-table th, .fs-report .fs-table td { padding: 5px 6px; }
.fs-report .fs-table thead th, .fs-report .fs-table thead th.num { white-space: normal; vertical-align: bottom; }
.fs-report-period { margin: 0 0 10px; }
.fs-report-list th { width: 30%; font-weight: 600; text-align: start; }
.fs-alert-n { display: inline-block; min-width: 1.8em; padding: 1px 7px; margin-inline-end: 6px; border-radius: 12px; text-align: center; color: #fff; background: #8a6d00; font-variant-numeric: tabular-nums; }
.fs-alert-bad .fs-alert-n { background: #b42318; }
.fs-alert-lines { margin: 0 0 8px; padding-inline-start: 20px; }
.fs-alert-lines li { margin: 2px 0; list-style: disc; }
.fs-pre { white-space: pre-wrap; font-family: inherit; background: var(--darkened-bg); padding: 10px 12px; border-radius: 4px; max-width: 80ch; }
.fs-daily .fs-panel { margin-bottom: 18px; }
@media print { .fs-scroll { overflow: visible; } }
