/* Kartu Produksi — read at a machine, on whatever is to hand.
   Sizing targets a phone held one-handed beside a running head, an iPad propped up, and a
   desk monitor. The run-order table is the one thing that must stay legible at every width,
   so it is the only element allowed to scroll sideways. */

.pc-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(880px, 94vw);
  max-height: 92vh;
  background: var(--glorion-surface, #1b2030);
  color: var(--glorion-text-primary, #e8e8ea);
  overflow: hidden;
}
.pc-dialog::backdrop { background: rgba(0, 0, 0, .62); }

.pc-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  position: sticky; top: 0; background: inherit; z-index: 2;
}
.pc-head h2 { margin: 0; font-size: 1.1rem; font-family: ui-monospace, monospace; }
.pc-sub { font-size: .85rem; opacity: .7; margin-top: 2px; }
.pc-head-actions { display: flex; align-items: center; gap: 8px; }
.pc-close {
  background: transparent; border: none; color: inherit;
  font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .7;
}
.pc-close:hover { opacity: 1; }

.pc-body { padding: 4px 20px 22px; overflow-y: auto; max-height: calc(92vh - 68px); }

.pc-sec { margin-top: 18px; }
.pc-banner {
  font-size: .72rem; letter-spacing: .09em; font-weight: 700;
  padding: 5px 9px; border-radius: 5px; display: inline-block; margin-bottom: 9px;
  background: rgba(255, 255, 255, .07); color: var(--glorion-text-secondary, #b6b6bd);
}
.pc-banner.pc-warn { background: #7c2d12; color: #fed7aa; }
.pc-warn-text { color: #fdba74; }

.pc-grid {
  display: grid; gap: 8px 18px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.pc-kv { display: flex; flex-direction: column; gap: 1px; font-size: .86rem; }
.pc-kv span { opacity: .6; font-size: .76rem; }

.pc-note { font-size: .86rem; line-height: 1.5; opacity: .85; margin: 0 0 10px; }
.pc-hint { font-size: .76rem; opacity: .55; margin: 8px 0 0; }

/* The run order. Wide on purpose — it is the setup instruction, so it gets the sideways
   scroll rather than being squeezed into unreadable columns. */
.pc-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pc-table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 430px; }
.pc-table th {
  text-align: left; font-size: .72rem; letter-spacing: .05em; opacity: .55;
  padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, .12); font-weight: 600;
}
.pc-table td { padding: 8px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.pc-stop { opacity: .5; width: 2.2rem; }
.pc-slot { font-family: ui-monospace, monospace; font-weight: 700; white-space: nowrap; }
.pc-code { font-family: ui-monospace, monospace; }
.pc-code em { opacity: .45; font-style: normal; }
.pc-line, .pc-stitches { text-align: right; white-space: nowrap; }
.pc-missing td { background: rgba(124, 45, 18, .22); }

/* A slot that runs again is a SECOND setup, not a duplicate row to skim past. */
.pc-repeat {
  font-size: .64rem; letter-spacing: .04em; padding: 1px 5px; border-radius: 3px;
  background: var(--glorion-gold, #c8a44b); color: #1b1b1b; font-weight: 700;
  font-family: system-ui, sans-serif; vertical-align: middle;
}

.pc-dot {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, .25);
}

.pc-sekoci {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  padding: 9px 12px; border-radius: 8px; background: rgba(255, 255, 255, .05); font-size: .86rem;
}
.pc-sekoci span { opacity: .6; font-size: .76rem; }

.pc-actions { margin-top: 12px; }
.pc-btn {
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: .84rem;
  border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: inherit;
}
.pc-btn:hover { background: rgba(255, 255, 255, .07); }
.pc-select {
  width: 100%; min-width: 180px; padding: 5px 7px; border-radius: 6px; font-size: .82rem;
  background: var(--glorion-bg, #11151f); color: inherit;
  border: 1px solid var(--glorion-gold, #c8a44b);
}

/* Two notes that must never read as one. */
.pc-catatan { padding: 10px 12px; border-radius: 8px; margin-bottom: 9px; }
.pc-catatan p { margin: 4px 0 0; font-size: .86rem; line-height: 1.5; white-space: pre-wrap; }
.pc-catatan-tag { font-size: .68rem; letter-spacing: .06em; font-weight: 700; opacity: .75; }
.pc-catatan-design { background: rgba(255, 255, 255, .05); border-left: 3px solid var(--glorion-gold, #c8a44b); }
.pc-catatan-job { background: rgba(196, 138, 160, .12); border-left: 3px solid #c48aa0; }

.pc-files { list-style: none; margin: 0; padding: 0; }
.pc-file {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: .85rem;
}
.pc-file-src {
  font-size: .66rem; letter-spacing: .05em; padding: 2px 6px; border-radius: 3px;
  background: rgba(255, 255, 255, .08); opacity: .8; white-space: nowrap;
}
.pc-file a { color: var(--glorion-gold, #c8a44b); text-decoration: none; word-break: break-all; }
.pc-file a:hover { text-decoration: underline; }
.pc-file-missing { opacity: .55; }
.pc-file-missing em { font-size: .74rem; color: #fdba74; font-style: normal; }

@media (max-width: 560px) {
  .pc-dialog { width: 100vw; max-height: 100vh; border-radius: 0; }
  .pc-body { max-height: calc(100vh - 64px); padding: 4px 14px 20px; }
  .pc-grid { grid-template-columns: 1fr 1fr; }
}

/* Paper. Operators who work from a printed sheet get the instruction, not the chrome. */
@media print {
  .pc-dialog {
    position: static; width: 100%; max-height: none; background: #fff; color: #000;
    border-radius: 0; overflow: visible;
  }
  .pc-dialog::backdrop { display: none; }
  .pc-body { max-height: none; overflow: visible; }
  .pc-head-actions, .pc-close, .pc-actions, .pc-hint { display: none !important; }
  .pc-banner { background: #eee !important; color: #000 !important; }
  .pc-banner.pc-warn { background: #ffd9b3 !important; }
  .pc-table th, .pc-table td { border-bottom: 1px solid #bbb; }
  .pc-missing td { background: #ffe9d6 !important; }
  .pc-repeat { background: #000 !important; color: #fff !important; }
  .pc-sec { break-inside: avoid; }
  .pc-tablewrap { overflow: visible; }
}

/* A repeated slot in edit mode. There is ONE mapping per slot, so the second stop shows where
   the answer lives rather than a second control that cannot hold a different value. */
.pc-sameas { font-size: .76rem; opacity: .55; font-style: italic; }

/* The design image, at the top beside the code. An operator checks the picture before the
   numbers — it is the fastest way to catch "wrong job" before any thread is loaded. */
.pc-head-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pc-thumb {
  width: 54px; height: 54px; object-fit: cover; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .14); flex: 0 0 auto; background: rgba(255,255,255,.04);
}

/* An item with no recorded codes says so, rather than offering the whole catalogue. An empty
   answer beats a confident wrong one. */
.pc-nocodes { font-size: .76rem; color: #fdba74; font-style: italic; }

/* Sekoci: type to search. The sekoci can legitimately be almost any cone, so unlike the slot
   picker it cannot be narrowed to the design's own threads — it gets a search instead. */
.pc-search { position: relative; min-width: 220px; flex: 1; }
.pc-search-input {
  width: 100%; padding: 6px 9px; border-radius: 6px; font-size: .84rem;
  background: var(--glorion-bg, #11151f); color: inherit;
  border: 1px solid var(--glorion-gold, #c8a44b);
}
.pc-search-list {
  margin-top: 5px; max-height: 240px; overflow-y: auto; border-radius: 7px;
  background: var(--glorion-bg, #11151f); border: 1px solid rgba(255, 255, 255, .12);
}
.pc-search-row {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 10px; background: transparent; border: none; color: inherit; cursor: pointer;
  font-size: .82rem; border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.pc-search-row:hover { background: rgba(255, 255, 255, .07); }
.pc-search-row.is-current { background: rgba(200, 164, 75, .16); }
.pc-search-code { font-family: ui-monospace, monospace; white-space: nowrap; }
.pc-search-name { opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-search-clear { color: #fdba74; }
.pc-search-empty, .pc-search-hint {
  padding: 8px 10px; font-size: .78rem; opacity: .55;
}

@media (max-width: 560px) {
  .pc-thumb { width: 44px; height: 44px; }
  .pc-sekoci { flex-direction: column; align-items: stretch; }
}

@media print {
  .pc-search, .pc-nocodes { display: none !important; }
  .pc-thumb { border: 1px solid #999; }
}

/* The sekoci value, shown WHILE the picker is open.
   Without it the control swallowed its own result: saving re-rendered the card, the search box
   came back empty, and nothing visibly changed until the operator pressed Selesai. A <select>
   keeps showing its chosen option for free; a search input does not, so it has to say so. */
.pc-current {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 6px 9px; margin-bottom: 7px; border-radius: 7px;
  background: rgba(200, 164, 75, .13); border: 1px solid rgba(200, 164, 75, .3);
  font-size: .84rem;
}
.pc-current-tag { font-size: .66rem; letter-spacing: .06em; opacity: .7; font-weight: 700; }
.pc-current-name { opacity: .65; font-size: .78rem; }
.pc-current-empty { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .1); }

/* One-shot pulse on a value just written — the toast is easy to miss on a phone at a machine. */
.pc-current-saved { animation: pcSaved 1.1s ease-out 1; }
@keyframes pcSaved {
  0%   { background: rgba(52, 211, 153, .42); border-color: rgba(52, 211, 153, .75); }
  100% { background: rgba(200, 164, 75, .13); border-color: rgba(200, 164, 75, .3); }
}
@media (prefers-reduced-motion: reduce) { .pc-current-saved { animation: none; } }

/* In-app confirmation. The GUARD stays — the owner asked for one against changing a thread
   code by accident — but Chrome's native box cannot be styled, truncates on a phone, and reads
   as something gone wrong rather than a question the app is asking. */
.pc-confirm {
  border: none; border-radius: 12px; padding: 0; width: min(380px, 90vw);
  background: var(--glorion-surface, #1b2030); color: var(--glorion-text-primary, #e8e8ea);
}
.pc-confirm::backdrop { background: rgba(0, 0, 0, .55); }
.pc-confirm-body { padding: 18px 20px 6px; }
.pc-confirm-body h3 { margin: 0 0 8px; font-size: 1rem; }
.pc-confirm-body p { margin: 0 0 8px; font-size: .86rem; line-height: 1.5; opacity: .82; }
.pc-confirm-warn {
  color: #fdba74; font-size: .82rem !important; opacity: 1 !important;
  padding: 7px 9px; border-radius: 6px; background: rgba(124, 45, 18, .25);
}
.pc-confirm-actions {
  display: flex; justify-content: flex-end; gap: 8px; padding: 10px 20px 18px;
}
.pc-btn-primary {
  background: var(--glorion-gold, #c8a44b); color: #1b1b1b;
  border-color: var(--glorion-gold, #c8a44b); font-weight: 600;
}
.pc-btn-primary:hover { filter: brightness(1.07); background: var(--glorion-gold, #c8a44b); }

/* The outstanding-work list, opened from the Item Master badge. A count you cannot act on
   becomes a count people stop reading, so every row goes to the item that needs the answer. */
.tmg-list { max-height: 46vh; overflow-y: auto; padding: 0 20px; }
.tmg-row {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; width: 100%;
  text-align: left; padding: 9px 10px; margin-bottom: 4px; border-radius: 7px;
  background: rgba(255, 255, 255, .04); border: 1px solid transparent;
  color: inherit; cursor: pointer; font-size: .85rem;
}
.tmg-row:hover { background: rgba(255, 255, 255, .09); border-color: rgba(200, 164, 75, .35); }
.tmg-code { font-family: ui-monospace, monospace; font-weight: 700; white-space: nowrap; }
.tmg-name { opacity: .68; flex: 1; min-width: 0; }
.tmg-need { font-size: .74rem; color: #fdba74; white-space: nowrap; }

/* Filling the queue IN PLACE. Redirecting to Item Master per item meant a search-open-fill-
   return round trip each time — fine for one, a headache at ten. The list already knows what
   is missing, so the answering happens here and a cleared design drops off. */
.tmg-item { margin-bottom: 4px; border-radius: 7px; overflow: hidden; background: rgba(255,255,255,.04); }
.tmg-item.is-done { opacity: .4; transition: opacity .35s ease; }
.tmg-row { border: none; background: transparent; }
.tmg-row:hover { background: rgba(255, 255, 255, .06); }
.tmg-caret { opacity: .5; font-size: 1.05rem; line-height: 1; }
.tmg-edit { padding: 2px 12px 12px; }
.tmg-loading { font-size: .82rem; opacity: .7; padding: 6px 0; }
.tmg-field-label {
  font-size: .68rem; letter-spacing: .06em; font-weight: 700; opacity: .55;
  margin: 8px 0 5px;
}
.tmg-field { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.tmg-field.is-saved { opacity: .55; }
.tmg-slot { font-size: .78rem; opacity: .7; min-width: 86px; white-space: nowrap; }
.tmg-select {
  flex: 1; min-width: 0; padding: 6px 8px; border-radius: 6px; font-size: .82rem;
  background: var(--glorion-bg, #11151f); color: inherit;
  border: 1px solid var(--glorion-gold, #c8a44b);
}
.tmg-select:disabled { border-color: rgba(52, 211, 153, .6); }
.tmg-edit-foot { margin-top: 9px; }
.tmg-link {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--glorion-gold, #c8a44b); font-size: .78rem; text-decoration: underline;
}
@media (max-width: 560px) {
  .tmg-field { flex-direction: column; align-items: stretch; gap: 3px; }
  .tmg-slot { min-width: 0; }
}

/* Unconfirmed client spec — the first thing read before setting up a machine. */
.pc-spec-alert { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; padding: 10px 12px;
  border-radius: 10px; background: #b91c1c; color: #fff; font-weight: 700; font-size: .95rem;
  overflow-wrap: anywhere; }
.pc-spec-alert svg { flex: none; }
@media print { .pc-spec-alert { background: #fff; color: #000; border: 2px solid #000; } }
