/* Shared Stock Take Exercise UI + compact create form */

/* ——— Create page (.ste) ——— */
.ste {
  --ste-g: #059669;
  --ste-gd: #065f46;
  --ste-line: #e2e8f0;
  --ste-muted: #64748b;
  --ste-ink: #0f172a;
  --ste-bg: #f1f5f9;
  font-size: 12px;
  color: var(--ste-ink);
  background: var(--ste-bg);
  min-height: calc(100vh - 48px);
  padding-bottom: 12px;
}

.ste-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: linear-gradient(135deg, #064e3b, #059669 70%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 6px rgba(6, 78, 59, 0.25);
}

.ste-bar h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ste-crumb {
  display: flex;
  gap: 0;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.ste-crumb li {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.55;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.ste-crumb li + li { border-left: 0; }
.ste-crumb li:first-child { border-radius: 4px 0 0 4px; }
.ste-crumb li:last-child { border-radius: 0 4px 4px 0; }
.ste-crumb li.on {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
}

.ste-bar-r { display: flex; gap: 6px; align-items: center; }

.ste-save,
.ste-cancel {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  border-radius: 5px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 5px 10px !important;
  line-height: 1.2 !important;
  cursor: pointer;
  text-decoration: none !important;
  border: 1px solid transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  min-height: 0 !important;
  height: auto !important;
}

.ste-save {
  background: #fff !important;
  color: var(--ste-gd) !important;
}

.ste-save:disabled { opacity: 0.55; cursor: not-allowed; }

.ste-cancel {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.ste-cancel:hover { background: rgba(255, 255, 255, 0.22) !important; color: #fff !important; }

.ste-alert {
  margin: 10px 14px;
  padding: 8px 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 6px;
  font-size: 12px;
}

.ste-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 10px;
  max-width: 1040px;
  margin: 10px auto 0;
  padding: 0 12px;
}

.ste-card {
  background: #fff;
  border: 1px solid var(--ste-line);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ste-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.ste-row--4 { grid-template-columns: repeat(4, 1fr); }
.ste-row--3 { grid-template-columns: repeat(3, 1fr); }

.ste-lab {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  margin: 0;
  color: inherit;
}

.ste-lab--block { display: flex; margin-bottom: 8px; }

.ste-lab > span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ste-muted) !important;
}

.ste-lab > span em,
.ste-side-h em {
  color: #dc2626;
  font-style: normal;
}

.ste-lab input,
.ste-lab select,
.ste-filter {
  width: 100%;
  border: 1px solid #d0d7e2 !important;
  border-radius: 5px !important;
  background: #f8fafc !important;
  color: var(--ste-ink) !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  min-height: 28px !important;
  height: 28px !important;
  line-height: 1.2 !important;
  box-shadow: none !important;
}

.ste-lab input:focus,
.ste-lab select:focus,
.ste-filter:focus {
  border-color: #34d399 !important;
  background: #fff !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15) !important;
}

.ste-sep {
  margin: 10px 0 6px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ste-muted);
}

.ste-sep small {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.8;
}

.ste-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.ste-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ste-ink);
}

.ste-switch input {
  width: 14px;
  height: 14px;
  accent-color: var(--ste-g);
  margin: 0;
}

.ste-switch small {
  color: var(--ste-muted);
  font-weight: 500;
}

.ste-side-h {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.ste-side-h--mt { margin-top: 10px; }

.ste-side-h strong {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ste-muted);
}

.ste-count {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 6px;
  line-height: 16px;
}

.ste-txt {
  margin-left: auto;
  border: none !important;
  background: none !important;
  color: var(--ste-g) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 0 2px !important;
  cursor: pointer;
  box-shadow: none !important;
  min-height: 0 !important;
  height: auto !important;
}

.ste-txt + .ste-txt { margin-left: 0; }

.ste-filter { margin-bottom: 6px; }

.ste-list {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--ste-line);
  border-radius: 6px;
  background: #fafbfc;
}

.ste-list--sm { max-height: 140px; }

.ste-item {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 8px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-size: 12px;
  color: var(--ste-ink);
  background: #fff;
}

.ste-item:last-child { border-bottom: 0; }
.ste-item:hover { background: #f0fdf4; }
.ste-item.on { background: #ecfdf5; }

.ste-item input {
  width: 14px;
  height: 14px;
  accent-color: var(--ste-g);
  margin: 0;
  flex-shrink: 0;
}

.ste-item-n {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.ste-item-t {
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 3px;
  padding: 1px 4px;
  flex-shrink: 0;
}

.ste-none {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 11px;
}

.ste-spin {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(6, 95, 70, 0.25);
  border-top-color: var(--ste-gd);
  border-radius: 50%;
  animation: ste-spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes ste-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .ste-shell { grid-template-columns: 1fr; }
  .ste-row--4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .ste-row,
  .ste-row--3,
  .ste-row--4 { grid-template-columns: 1fr; }
  .ste-crumb { display: none; }
}

/* ——— Shared exercise pages (.stk-*) ——— */
.stk-wrap { min-height: 100vh; background: #f0f2f8; font-size: 0.78rem; color: #1a1f36; }
.stk-topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
  background: linear-gradient(135deg, #0f4c3a 0%, #15803d 100%);
  color: #fff; padding: 0.55rem 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.15);
  position: sticky; top: 0; z-index: 50;
}
.stk-topbar-title { margin: 0; font-size: 0.95rem; font-weight: 700; }
.stk-topbar-sub { margin: 0; font-size: 0.62rem; opacity: .75; }
.stk-top-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.stk-btn { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0.7rem; border-radius: 6px; font-size: 0.72rem; font-weight: 600; text-decoration: none; border: none; cursor: pointer; }
.stk-btn--ghost { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.stk-btn--light { background: #fff; color: #15803d; }
.stk-gen-btn {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.35rem 1rem;
  background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; border: none; border-radius: 6px;
  font-size: 0.74rem; font-weight: 700; cursor: pointer;
}
.stk-gen-btn:disabled { opacity: .55; }
.stk-body { padding: 0.65rem 1rem 1.5rem; max-width: 1600px; margin: 0 auto; }
.stk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.stk-card {
  background: #fff; border: 1px solid #e2e7f3; border-radius: 8px; padding: .65rem .5rem; text-align: center;
  text-decoration: none; color: inherit;
}
.stk-card .n { font-size: 1.25rem; font-weight: 800; color: #0f4c3a; }
.stk-card .l { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; color: #8492b4; font-weight: 700; }
.stk-filter-card, .stk-table-card, .stk-info {
  background: #fff; border: 1px solid #e2e7f3; border-radius: 8px; padding: 0.55rem 0.75rem; margin-bottom: 0.55rem;
}
.stk-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.stk-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.stk-table thead { background: linear-gradient(135deg, #0f4c3a, #15803d); }
.stk-table th { padding: 0.35rem 0.5rem; color: rgba(255,255,255,.9); font-size: 0.58rem; text-transform: uppercase; text-align: left; }
.stk-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid #f0f3fa; }
.stk-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.stk-pill { display: inline-block; padding: 0.12rem 0.4rem; border-radius: 4px; font-size: 0.58rem; font-weight: 700; }
.stk-pill--pending { background: #f1f5f9; color: #475569; }
.stk-pill--progress { background: #dbeafe; color: #1d4ed8; }
.stk-pill--approval { background: #ffedd5; color: #c2410c; }
.stk-pill--approved { background: #dcfce7; color: #166534; }
.stk-pill--posted { background: #d1fae5; color: #065f46; }
.stk-pill--rejected { background: #fee2e2; color: #991b1b; }
.stk-var-exact { background: #dcfce7 !important; }
.stk-var-shortage { background: #fef9c3 !important; }
.stk-var-excess { background: #fee2e2 !important; }
.stk-input { border: 1px solid #d8dff0; border-radius: 6px; padding: 0.28rem 0.5rem; font-size: 0.75rem; background: #f7f9fd; width: 100%; }
.stk-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; position: sticky; top: 52px; z-index: 40; background: #f0f2f8; padding: .35rem 0; }
.stk-sticky-totals { position: sticky; bottom: 0; background: #0f4c3a; color: #fff; padding: .45rem .75rem; display: flex; gap: 1.25rem; justify-content: flex-end; border-radius: 8px 8px 0 0; }
.stk-state { padding: 2rem; text-align: center; color: #94a3b8; }
@media (max-width: 768px) {
  .stk-table { font-size: 0.65rem; }
  .stk-topbar-title { font-size: 0.85rem; }
}

/* ——— Forced SweetAlert2 styling (theme CSS otherwise strips defaults) ——— */
.ste-swal-container.swal2-container,
.swal2-container.ste-swal-container {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  z-index: 20000 !important;
  background: rgba(15, 23, 42, 0.48) !important;
  pointer-events: auto !important;
}
.ste-swal-popup.swal2-popup,
.swal2-popup.ste-swal-popup {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 auto !important;
  transform: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  border-radius: 12px !important;
  padding: 1.1rem 1.15rem 1rem !important;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.28) !important;
  border: 1px solid #e2e8f0 !important;
  width: min(460px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  background: #fff !important;
  color: #0f172a !important;
  box-sizing: border-box !important;
}
.ste-swal-title {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin: 0 0 0.35rem !important;
  padding: 0 !important;
}
.ste-swal-html {
  margin: 0 !important;
  padding: 0 !important;
  color: #334155 !important;
  font-size: 13px !important;
}
.ste-swal-icon {
  margin: 0.25rem auto 0.5rem !important;
}
.ste-swal-actions {
  display: flex !important;
  gap: 8px !important;
  justify-content: flex-end !important;
  margin: 1rem 0 0 !important;
  padding: 0 !important;
  width: 100% !important;
}
.ste-swal-confirm,
.ste-swal-cancel,
.ste-swal-ok,
.ste-swal-warn,
.ste-swal-primary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 36px !important;
  padding: 0.45rem 0.95rem !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  border: 1px solid transparent !important;
  cursor: pointer !important;
  box-shadow: none !important;
  margin: 0 !important;
}
.ste-swal-confirm {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #fff !important;
}
.ste-swal-confirm:hover { background: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }
.ste-swal-ok {
  background: #16a34a !important;
  border-color: #16a34a !important;
  color: #fff !important;
}
.ste-swal-ok:hover { background: #15803d !important; border-color: #15803d !important; color: #fff !important; }
.ste-swal-warn {
  background: #ea580c !important;
  border-color: #ea580c !important;
  color: #fff !important;
}
.ste-swal-warn:hover { background: #c2410c !important; border-color: #c2410c !important; color: #fff !important; }
.ste-swal-primary {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
}
.ste-swal-primary:hover { background: #1d4ed8 !important; border-color: #1d4ed8 !important; color: #fff !important; }
.ste-swal-cancel {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}
.ste-swal-cancel:hover { background: #f1f5f9 !important; border-color: #94a3b8 !important; color: #0f172a !important; }

