/* ============================================================
   STOK-SOKA — Pages CSS
   Layout spesifik per halaman
   ============================================================ */

/* ------------------------------------------------------------
   1. LOGIN PAGE
   ------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-sm);
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 24px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-error.is-visible {
  display: block;
}

.pin-input {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.pin-input input {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  transition: all var(--dur) var(--ease);
}

.pin-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ------------------------------------------------------------
   2. DASHBOARD
   ------------------------------------------------------------ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.list-row:last-child {
  border-bottom: none;
}

.list-row-main {
  flex: 1;
  min-width: 0;
}

.list-row-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.list-row-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ------------------------------------------------------------
   3. OPNAME PAGE
   ------------------------------------------------------------ */
.opname-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: var(--header-h);
  z-index: 50;
}

.opname-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.opname-progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.opname-progress .progress {
  flex: 1;
}

.opname-category {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}

.opname-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur) var(--ease);
  min-height: 48px;
}

.opname-category-header:hover {
  background: var(--bg);
}

.opname-category-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.opname-category-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
}

.opname-category-arrow {
  color: var(--text-subtle);
  transition: transform var(--dur) var(--ease);
  width: 16px;
  height: 16px;
}

.opname-category.is-open .opname-category-arrow {
  transform: rotate(180deg);
}

.opname-category-body {
  display: none;
  border-top: 1px solid var(--border);
}

.opname-category.is-open .opname-category-body {
  display: block;
}

.opname-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
  min-height: 56px;
}

.opname-item:last-child {
  border-bottom: none;
}

.opname-item.is-checked {
  background: var(--primary-soft);
}

.opname-item.is-critical {
  background: #FEF2F2;
}

.opname-item.is-critical.is-checked {
  background: #FEE2E2;
}

.opname-item-info {
  flex: 1;
  min-width: 0;
}

.opname-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
}

.opname-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.opname-item-input {
  width: 72px;
  height: 44px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  transition: all var(--dur) var(--ease);
  flex-shrink: 0;
}

.opname-item-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.opname-item-input.is-filled {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.opname-item-foto {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}

.opname-item-foto:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.opname-item-foto.has-foto {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.opname-item-foto svg {
  width: 16px;
  height: 16px;
}

.opname-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  margin: 16px -16px -16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
  z-index: 40;
}

@media (max-width: 768px) {
  .opname-footer {
    margin: 16px -12px -12px;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
  }
}

.opname-footer .btn {
  flex: 1;
}

/* ------------------------------------------------------------
   4. PRODUK PAGE
   ------------------------------------------------------------ */
.produk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

@media (max-width: 480px) {
  .produk-grid {
    grid-template-columns: 1fr;
  }
}

.produk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: all var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
}

.produk-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.produk-card-foto {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  overflow: hidden;
}

.produk-card-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.produk-card-foto svg {
  width: 40px;
  height: 40px;
  opacity: 0.4;
}

.produk-card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.produk-card-kode {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
  font-family: ui-monospace, monospace;
}

.produk-card-nama {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.produk-card-kategori {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
  align-self: flex-start;
}

.produk-card-stok {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.produk-card-stok-value {
  font-size: 18px;
  font-weight: 700;
}

.produk-card-stok-value.success { color: var(--success); }
.produk-card-stok-value.warning { color: var(--warning); }
.produk-card-stok-value.danger { color: var(--danger); }

.produk-card-stok-label {
  font-size: 11px;
  color: var(--text-muted);
}

.produk-card-actions {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.produk-card-actions .btn {
  flex: 1;
}

/* ------------------------------------------------------------
   5. ORDER PAGE
   ------------------------------------------------------------ */
.order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  transition: all var(--dur) var(--ease);
}

.order-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.order-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.order-card-kode {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  font-family: ui-monospace, monospace;
}

.order-card-tanggal {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.order-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.order-card-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.order-card-row-label {
  color: var(--text-muted);
}

.order-card-row-value {
  color: var(--text);
  font-weight: 500;
}

.order-card-actions {
  display: flex;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.order-card-actions .btn {
  flex: 1;
}

/* Order items (di modal) */
.order-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
}

.order-item-info {
  flex: 1;
  min-width: 0;
}

.order-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.order-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.order-item-remove {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  transition: background var(--dur) var(--ease);
}

.order-item-remove:hover {
  background: var(--danger-bg);
}

/* ------------------------------------------------------------
   6. LAPORAN PAGE
   ------------------------------------------------------------ */
.laporan-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.laporan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
}

.laporan-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.laporan-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.laporan-card-tanggal {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.laporan-card-staf {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.laporan-card-stats {
  display: flex;
  gap: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.laporan-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.laporan-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.laporan-stat-value.danger { color: var(--danger); }
.laporan-stat-value.warning { color: var(--warning); }

.laporan-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* WA preview */
.wa-preview {
  background: #E5DDD5;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3e%3cpath fill='%23d9d0c5' d='M20 20h10v10H20zM60 50h10v10H60zM30 70h10v10H30z'/%3e%3c/svg%3e");
  padding: 16px;
  border-radius: var(--r);
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #111;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  position: relative;
}

.wa-bubble {
  background: #FFFFFF;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
  max-width: 100%;
}

.wa-bubble-time {
  font-size: 10px;
  color: #667781;
  text-align: right;
  margin-top: 4px;
}

/* ------------------------------------------------------------
   7. STAF PAGE
   ------------------------------------------------------------ */
.staf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.staf-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: all var(--dur) var(--ease);
}

.staf-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.staf-card-info {
  flex: 1;
  min-width: 0;
}

.staf-card-nama {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.staf-card-peran {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.staf-card-actions {
  display: flex;
  gap: 4px;
}

/* ------------------------------------------------------------
   8. PENGATURAN PAGE
   ------------------------------------------------------------ */
.pengaturan-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 12px;
}

.pengaturan-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.pengaturan-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ------------------------------------------------------------
   9. KATEGORI / SATUAN / PERAN LIST (di pengaturan)
   ------------------------------------------------------------ */
.simple-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.simple-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--r-sm);
  min-height: 44px;
}

.simple-item-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.simple-item-actions {
  display: flex;
  gap: 2px;
}

/* ------------------------------------------------------------
   10. DETAIL ORDER / LAPORAN
   ------------------------------------------------------------ */
.detail-section {
  margin-bottom: 16px;
}

.detail-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row-label {
  color: var(--text-muted);
}

.detail-row-value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

/* Timeline status */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

.timeline-item {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 20px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  border: 3px solid var(--surface);
  flex-shrink: 0;
  z-index: 1;
}

.timeline-item.is-done .timeline-dot {
  background: var(--primary);
}

.timeline-item.is-current .timeline-dot {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.timeline-content {
  flex: 1;
  padding-top: 1px;
}

.timeline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.timeline-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}