@charset "UTF-8";
/* company.css — The Company page: profile, bank cards, logins, email settings.
   Loaded in order by templates/partials/styles.html. */

/* ================================ Company ==================================
   The Company page (templates/company/) and its wide form panel. */

/* a wider right-hand panel for a form with many fields; .form-grid then
   puts two fields side by side */
.modal--right.modal--wide .modal__panel {
  width: min(720px, 100vw);
}
/* extra wide: a form with many fields and a table inside (Customer /
   Supplier with its contacts) — three fields to a row */
.modal--right.modal--xl .modal__panel {
  width: min(1040px, 100vw);
}

/* a small heading between groups of fields in a form */
.form-section {
  grid-column: 1 / -1;
  margin: var(--s-2) 0 calc(var(--s-1) * -1);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.form-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* the page: a column of panels */
.company-body {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* icon + name + "FY 2026-27 · you are the owner" */
.company-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}
.company-head__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: var(--r-md);
  font-size: 1.3rem;
  color: var(--primary-600);
  background: var(--primary-50);
}
.company-head__name {
  margin: 0;
  font-size: var(--fs-lg);
}
/* the uploaded logo in place of the building icon */
.company-head__logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: #fff;
}
/* logo / signature shown among the company details */
.kv-image {
  display: block;
  max-width: 160px;
  max-height: 56px;
  object-fit: contain;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;   /* white like paper, so dark-on-clear images stay visible in dark mode */
}

/* a heading row inside .kv-grid ("Bank details"), with a rule above it */
.kv-grid__head {
  padding-top: var(--s-3);
  border-top: 1px dashed var(--border);
}
.kv-grid__head dt {
  color: var(--primary-600);
}

/* ---- Customer / Supplier form (account_master party_form.html) ------------- */
/* a field's label with a small button at its right (Ship to: copy address) */
.field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.field__label-row > label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.field__label-row .icon-btn {
  width: 26px;
  height: 26px;
  font-size: 0.95rem;
}

/* the opening balance and its Dr / Cr side, on one line */
.input-pair {
  display: flex;
  gap: var(--s-2);
}
.input-pair .input {
  flex: 1 1 auto;
  min-width: 0;
}
.input-pair .select {
  flex: 0 0 84px;
}
/* the contact rows: small inputs, the Main box and ✕ narrow */
.contacts-table td {
  padding: 3px 4px;
  vertical-align: top;
}
.contacts-table .input--sm {
  width: 100%;
  max-width: none;
  min-height: 0;   /* the stock .input keeps every box at least 44px tall */
  height: 28px;
  padding: 0 8px;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  text-align: left;
}
.contacts-table .icon-btn {
  width: 26px;
  height: 26px;
  font-size: 0.95rem;
}
.contacts-table__main,
.contacts-table__remove {
  width: 44px;
  text-align: center;
}
.contacts-table__main input {
  width: 16px;
  height: 16px;
  margin-top: 6px;
  accent-color: var(--primary-500);
}
.contacts-table tr[hidden] {
  display: none;
}
.contacts-add {
  margin-top: var(--s-2);
  align-self: flex-start;
}

/* ---- Import panel (items/partials/product_import.html) ---------------------- */
.import-steps {
  margin: 0;
  padding-left: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
.import-steps > li::marker {
  font-weight: 700;
  color: var(--primary-600);
}
.import-steps > li {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.import-steps__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.import-columns td {
  vertical-align: top;
}
/* a short reference table inside the panel: its header scrolls with it */
.import-columns th {
  position: static;
}
/* the problems of a failed upload: "Row 7  Unit: "Kgs" not found …" */
.import-errors {
  list-style: none;
  margin: 0 0 var(--s-5);
  padding: var(--s-2) var(--s-3);
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
  font-size: var(--fs-sm);
}
.import-errors li {
  padding: 3px 0;
}
.import-errors__row {
  display: inline-block;
  min-width: 64px;
  font-weight: 700;
  color: var(--danger);
}

/* ---- "GenerousEbook · loading…" (main_base.html, shell.js initLoader) -------------
   A small pill in the centre of the screen, above everything (panels too),
   while a page or an htmx request is on its way.                          */
.app-loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1300;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  pointer-events: none;   /* never in the way of a click */
  animation: loader-in 0.18s ease-out;
}
.app-loader[hidden] {
  display: none;
}
/* the brand's blue-to-teal ring, turning */
.app-loader__spin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary-500), var(--accent-500), transparent 75%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: loader-spin 0.8s linear infinite;
}
.app-loader__brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-loader__text {
  color: var(--text-3);
}
@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes loader-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
}
@media (prefers-reduced-motion: reduce) {
  .app-loader__spin {
    animation-duration: 2s;   /* still turning, just calmly */
  }
}

/* ---- Wide tables: .table--wide (Items, Customers, Suppliers) --------------
   Many columns, one of them long (the name). Left alone, the browser squeezes
   the name into a narrow strip and wraps it line after line. So:
     - a cell with two lines (name + part no., qty + value) is one block
     - short columns never wrap; the name keeps a readable width — when the
       screen is too narrow for all that, the table scrolls sideways instead
     - Action is pinned to the right edge, so Edit / Delete stay in reach
   Phones (≤ 640px) get the stacked cards instead — see the media query.  */
.cell-lines {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cell-lines__sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
  white-space: nowrap;
}

@media (min-width: 641px) {
  .table--wide th,
  .table--wide td {
    white-space: nowrap;
  }
  .table--wide [data-col="name"] {
    white-space: normal;
    min-width: 220px;
    max-width: 380px;
  }

  /* Action pinned right. Each cell takes its row's own colour (plain, stripe
     or hover) so the pinned cell never shows the columns sliding under it. */
  .table--wide tbody tr {
    background-color: var(--surface);
  }
  .table--wide td.actions {
    position: sticky;
    right: 0;
    background-color: inherit;
    box-shadow: -10px 0 10px -10px rgb(0 0 0 / 0.18);
  }
  .table--wide th.actions {
    position: sticky;
    right: 0;
    z-index: 3;   /* above the pinned header row and the cells */
    box-shadow: -10px 0 10px -10px rgb(0 0 0 / 0.18);
  }
}

@media (max-width: 640px) {
  /* on a card the two-line cells sit on the right, like every value */
  .table--wide .cell-lines {
    align-items: flex-end;
    text-align: right;
  }
  .table--wide .cell-lines__sub {
    white-space: normal;
  }
}

/* ---- Items (items/product.html) and Price List ---------------------------- */
/* the small picture in the item table */
.item-thumb {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
}
.item-thumb--empty {
  color: var(--text-3);
  background: var(--surface-2);
  font-size: 1rem;
}
/* a value worked out for you (Opening value): looks like a box, not typed in */
.input--readonly {
  display: flex;
  align-items: center;
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 600;
}
/* the small price boxes in the Fix prices table */
.input--sm {
  height: 32px;
  padding: 0 var(--s-2);
  max-width: 130px;
  text-align: right;
}
.rates-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.rates-head .search {
  flex: 1 1 240px;
}
.rates-table__box {
  width: 150px;
}
.rates-table__box .field-error {
  display: block;
  text-align: right;
}
.rates-table tr[hidden] {
  display: none;
}

/* ---- History panel (activity/history.html) ------------------------------ */
.modal__head h2 ion-icon {
  vertical-align: -3px;
  color: var(--primary-600);
}
.history__back {
  margin-bottom: var(--s-4);
}
.history__note {
  margin: 0 0 var(--s-4);
  font-size: var(--fs-sm);
}
/* one record: created / modified summary */
.history-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-4);
  margin: 0 0 var(--s-5);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.history-summary__wide {
  grid-column: 1 / -1;
}
.history-summary dt {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.history-summary dd {
  margin: 2px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: baseline;
}
/* the entries: a line down the left, an icon per change */
.history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.history__item {
  position: relative;
  display: flex;
  gap: var(--s-3);
  padding-bottom: var(--s-4);
}
.history__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 1px;
  background: var(--border-strong);
}
.history__icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: 0.95rem;
  color: var(--primary-600);
  background: color-mix(in srgb, var(--primary-500) 14%, var(--surface));
}
.history__item--created .history__icon {
  color: var(--success, #16a34a);
  background: color-mix(in srgb, var(--success, #16a34a) 14%, var(--surface));
}
.history__item--deleted .history__icon {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
}
.history__text {
  min-width: 0;
  flex: 1;
  font-size: var(--fs-md);
  line-height: 1.5;
}
.history__text time {
  font-size: var(--fs-sm);
}
.history__text .badge {
  vertical-align: 1px;
}
.history__record {
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--primary-600);
  cursor: pointer;
  text-align: left;
}
.history__record:hover {
  text-decoration: underline;
}
.history__changes {
  list-style: none;
  margin: var(--s-2) 0 0;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  font-size: var(--fs-sm);
}
.history__changes li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 2px 0;
  overflow-wrap: anywhere;
}
.history__field {
  min-width: 90px;
  font-weight: 600;
  color: var(--text-2);
}
.history__changes del {
  color: var(--danger);
}
.history__changes ins {
  text-decoration: none;
  color: var(--success, #16a34a);
  font-weight: 600;
}
.history__changes ion-icon {
  color: var(--text-3);
}

/* ---- image upload (partials/image_field.html): preview + picker ---------- */
.image-pick {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}
.image-pick__thumb {
  display: grid;
  place-items: center;
  width: 96px;
  height: 64px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text-3);
  font-size: 1.5rem;
}
.image-pick__thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.image-pick__thumb [hidden] {
  display: none;
}
.image-pick__controls {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}
.file-input {
  max-width: 100%;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.file-input::file-selector-button {
  margin-right: var(--s-2);
  padding: 5px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.file-input::file-selector-button:hover {
  border-color: var(--text-3);
}
.image-pick__remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-2);
  cursor: pointer;
}

/* label / value pairs, as many columns as fit */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: var(--s-4) var(--s-6);
  margin: 0;
  padding: var(--s-5);
}
.kv-grid > div {
  min-width: 0;
}
.kv-grid__wide {
  grid-column: 1 / -1;
}
.kv-grid dt {
  margin-bottom: 2px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.kv-grid dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}
