/* ==========================================================================
   Stock document forms (Stock Transfers, Stock Adjustments, Stock Take)
   Clean "document" layout: action bar + status stepper, sheet with underlined
   fields, and a lightweight lines grid with an "Add a line" row.
   All colours come from theme variables so light/dark themes both work.
   ========================================================================== */

.stk-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px 28px;
  background: var(--theme-bg, #f7f8fa);
  min-height: calc(100vh - 56px);
  font-size: 13px;
  color: var(--theme-text, #374151);
  box-sizing: border-box;
}

/* ---- Breadcrumb row -------------------------------------------------- */
.stk-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.stk-crumb-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--theme-primary, #1d6fe0);
  font-weight: 500;
}
.stk-crumb-link:hover { text-decoration: underline; }
.stk-crumb-sep { color: #9ca3af; }
.stk-crumb-current { color: var(--theme-text, #111827); font-weight: 500; }

/* ---- Action bar ------------------------------------------------------ */
.stk-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.stk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.stk-btn {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.stk-btn:disabled { opacity: .55; cursor: not-allowed; }
.stk-btn-primary {
  background: var(--theme-primary, #1d6fe0);
  color: #fff;
}
.stk-btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.stk-btn-ghost {
  background: var(--theme-surface, #fff);
  color: var(--theme-text, #374151);
  border-color: var(--theme-border, #d1d5db);
  font-weight: 500;
}
.stk-btn-ghost:hover:not(:disabled) { background: var(--theme-surface-muted, #f3f4f6); }

.stk-done-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 600;
  background: #e8f5ee;
  color: #166534;
  border: 1px solid #bbe5cb;
}

/* ---- Status stepper (chevron style) ---------------------------------- */
.stk-stepper { display: flex; align-items: stretch; }
.stk-step {
  position: relative;
  padding: 5px 20px 5px 22px;
  margin-left: -8px;
  font-size: 13px;
  color: #6b7280;
  background: #e9ebef;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.stk-step:first-child {
  margin-left: 0;
  padding-left: 16px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}
.stk-step.active {
  background: #dcdaec;
  color: var(--theme-text, #111827);
  font-weight: 700;
}

/* ---- Sheet ----------------------------------------------------------- */
.stk-sheet {
  background: var(--theme-surface, #fff);
  border: 1px solid var(--theme-border, #e5e7eb);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  padding: 16px 22px 22px;
}

.stk-title-input {
  display: block;
  width: 60%;
  min-width: 260px;
  border: none;
  border-bottom: 1px solid var(--theme-border, #cbd5e1);
  background: transparent;
  outline: none;
  padding: 0 0 4px;
  margin-bottom: 18px;
  font-size: 26px;
  font-weight: 600;
  color: var(--theme-text, #111827);
}
.stk-title-input:focus { border-bottom: 2px solid var(--theme-primary, #1d6fe0); }

.stk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 56px;
  margin-bottom: 22px;
}
@media (max-width: 900px) { .stk-grid { grid-template-columns: 1fr; } }

.stk-field {
  display: flex;
  align-items: flex-end;
  min-height: 30px;
}
.stk-field > label {
  width: 150px;
  flex-shrink: 0;
  padding-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--theme-text-muted, #4b5563);
}
.stk-input {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 1px solid var(--theme-border, #94a3b8);
  border-radius: 0;
  background: transparent;
  outline: none;
  padding: 3px 0 4px;
  font-size: 13px;
  color: var(--theme-text, #111827);
  transition: border-color .15s;
}
.stk-input:focus { border-bottom: 2px solid var(--theme-primary, #1d6fe0); padding-bottom: 3px; }
.stk-input:disabled, .stk-input[readonly] { color: #6b7280; border-bottom-style: dashed; }
.stk-check { width: 16px; height: 16px; margin: 0 0 6px; accent-color: var(--theme-primary, #1d6fe0); }
.stk-static { flex: 1; padding: 3px 0 4px; border-bottom: 1px solid var(--theme-border, #e5e7eb); color: var(--theme-text, #374151); }

/* ---- Tabs ------------------------------------------------------------ */
.stk-tabs { display: flex; border-bottom: 1px solid var(--theme-border, #e5e7eb); }
.stk-tab {
  padding: 7px 14px;
  font-size: 13px;
  color: var(--theme-text-muted, #6b7280);
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
}
.stk-tab.active {
  color: var(--theme-text, #111827);
  background: var(--theme-surface, #fff);
  border-color: var(--theme-border, #e5e7eb);
  border-radius: 3px 3px 0 0;
}

/* ---- Lines grid ------------------------------------------------------ */
.stk-table-wrap { overflow-x: auto; }
.stk-table { width: 100%; border-collapse: collapse; }
.stk-table th {
  padding: 10px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--theme-text, #111827);
  border-bottom: 1px solid var(--theme-border, #e5e7eb);
  white-space: nowrap;
}
.stk-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--theme-border, #eef0f3);
  vertical-align: middle;
}
.stk-table tbody tr:not(.stk-blank-row):not(.stk-add-row):hover { background: var(--theme-surface-muted, #f8fafc); }
.stk-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stk-table .stk-actcol { width: 36px; text-align: right; }

.stk-cell-input {
  width: 100%;
  max-width: 130px;
  margin-left: auto;
  display: block;
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  outline: none;
  padding: 3px 0;
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--theme-text, #111827);
}
.stk-cell-input:hover { border-bottom-color: var(--theme-border, #cbd5e1); }
.stk-cell-input:focus { border-bottom: 2px solid var(--theme-primary, #1d6fe0); }

.stk-add-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #6b4f8f;
  font-weight: 500;
  font-size: 13px;
}
.stk-add-link:hover { text-decoration: underline; }

.stk-blank-row td { height: 28px; background: rgba(0, 0, 0, 0.022); border-bottom: 1px solid rgba(0, 0, 0, 0.05); }
.stk-blank-row:nth-child(even) td { background: rgba(0, 0, 0, 0.035); }

.stk-del {
  background: transparent;
  border: none;
  color: #9ca3af;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.stk-del:hover { color: #dc2626; background: #fee2e2; }

.stk-empty-hint { color: #9ca3af; font-size: 12px; padding: 6px 2px; }
.stk-over { font-size: 11px; color: #dc2626; margin-top: 2px; text-align: right; }

.stk-pos { color: #15803d; font-weight: 600; }
.stk-neg { color: #b91c1c; font-weight: 600; }
.stk-zero { color: #6b7280; }
.stk-link-num { color: #6b4f8f; text-decoration: underline dotted; text-underline-offset: 3px; }

.stk-row-variance td { background: #fffbeb; }

/* ---- Totals footer --------------------------------------------------- */
.stk-totals {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  padding: 14px 10px 0;
  font-size: 13px;
}
.stk-totals .lbl { color: #6b7280; margin-right: 6px; }
.stk-totals .val { font-weight: 700; color: var(--theme-text, #111827); }

/* ---- Dark theme tweaks ----------------------------------------------- */
html[data-theme="dark"] .stk-step { background: #2b3342; color: #9aa4b5; }
html[data-theme="dark"] .stk-step.active { background: #3b4560; color: #fff; }
html[data-theme="dark"] .stk-blank-row td { background: rgba(255,255,255,.03); }
html[data-theme="dark"] .stk-row-variance td { background: rgba(250,204,21,.08); }
html[data-theme="dark"] .stk-add-link, html[data-theme="dark"] .stk-link-num { color: #b8a2e0; }
